W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2012

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

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 29 Jun 2012 21:35:26 +0000 (UTC)
To: Paul Adenot <padenot+whatwg@mozilla.com>
Message-ID: <Pine.LNX.4.64.1206292126020.30734@ps20323.dreamhostps.com>
Cc: whatwg@whatwg.org
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 :
> 
> <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".

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

Correct.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 29 June 2012 21:35:56 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:43 UTC