[whatwg] media attribute of <source> element, default behavior on getting the property.

Mounir Lamouri mounir at lamouri.fr
Tue May 8 21:43:38 PDT 2012

On 05/08/2012 10:29 AM, 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 :
> <video>
>   <source id="asource" src="media.webm">
> </video>
> What should document.getElementById("asource").media [1] be ?
> The spec [2] 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 [1] should return "all".

The quoted text says that the default is 'all', not that the default
value of the IDL attribute is 'all'. This is speaking of how the UA
should handle internally the attribute being omitted.

> 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 [1] should return an empty string, but
> the <source> is matched as if media was "all".

AFAICT, this is what should be taken into account.


More information about the whatwg mailing list