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

Paul Adenot padenot+whatwg at mozilla.com
Tue May 8 10:29:05 PDT 2012


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".

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".

The part of the spec about reflection [3] 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 [1] should return an empty string.

What is the actual intended behavior for this feature ? This section may 
need some clarification.

Thanks,
Paul.

[2]: http://www.whatwg.org/html#attr-source-media
[3]: http://www.whatwg.org/html#reflect, sixth paragraph


More information about the whatwg mailing list