[whatwg] media attribute of <source> element, default behavior on getting the property.
ian at hixie.ch
Fri Jun 29 14:35:26 PDT 2012
On Tue, 8 May 2012, Paul Adenot wrote:
> Currently implementing the "media" attribute for the <source> element in
> Gecko, we are not sure on how to interpret the spec when the attribute
> is not set in the HTML source.
> Considering this snipped of code :
> <source id="asource" src="media.webm">
> What should document.getElementById("asource").media  be ?
> The spec  currently says :
> > The default, if the media attribute is omitted, is "all", meaning that
> > by default the media resource is suitable for all media.
> At that point, we understand that if no media attribute is specified,
> the expression  should return "all".
No, that sentence doesn't say anything except that "the default" (a
constant value used elsewhere in the spec) is the value "all".
Specifically, this part of the sentence is a definition:
# The default, if the media attribute is omitted, is "all"
...and this part of the sentence is a non-normative statement of fact:
# meaning that by default the media resource is suitable for all media.
The constant part is never used in the specification, so it actually has
no effect on implementations whatsoever. It is, effectively, also a
statement of fact. (It it describing what happens in step 6 of the second
set of steps of step 7 of the " resource selection algorithm", which says:
"If candidate has a media attribute whose value does not match the
environment [...]", where the absence of the media attribute thus causes
the step to be ignored -- meaning it behaves as if it was "all".)
I've tried to make this clearer.
> Then spec then says :
> > The IDL attributes src, type, and media must reflect the respective ?
> > content attributes of the same name.
> At this point, we understand that  should return an empty string, but the
> <source> is matched as if media was "all".
> The part of the spec about reflection  states :
> > If a reflecting IDL attribute is a DOMString attribute but doesn't
> > fall into any of the above categories, then the getting and setting
> > must be done in a transparent, case-preserving manner.
> which means that  should return an empty string.
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg