[whatwg] question on @width and @height attributes on <video>

Ian Hickson ian at hixie.ch
Fri Jan 7 16:30:42 PST 2011

On Mon, 8 Nov 2010, Silvia Pfeiffer wrote:
> I am staring at the @width and @height attributes of the <video> 
> element, because I have just noticed that the implementation of IE9 
> doesn't respect percentage values in there. I remembered Hixie saying 
> that if you gave them a value that included "px", that's strictly 
> speaking not valid, since the value is a unsigned long but a browser 
> will just drop the "px" and interpret it correctly.
> I am now wondering if a percentage value is correct, since the percent 
> sign isn't part of unsigned long either[1]. I have followed the links 
> through to the parsing part for dimension values, which I think includes 
> http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#rules-for-parsing-dimension-values 
> . So, IIUC, percentage values are correct. But that doesn't seem to 
> agree with "unsigned long".
> Why do we have this requirement of @width and @height being unsigned 
> long and not DOMString as for iframe, embed and object? <img> seems to 
> share the same fate, such that I am confused whether a percentage value 
> on @width and @height attributes on <img> are not allowed any more 
> either.
> Essentially, I am wondering if IE has implemented this correctly or 
> whether this is still a bug they will have to fix, and whether 
> percentages are indeed correct withing the given specification.

On Mon, 8 Nov 2010, Simon Pieters wrote:
> That it's unsigned long is only relevant for getting and setting the 
> .width and .height IDL attributes, it's not relevant for how the content 
> attribute's value is interpreted.
> Following the link for <video width> I come to
> http://www.whatwg.org/specs/web-apps/current-work/complete/the-map-element.html#attr-dim-width
> which says
> "Author requirements: The width and height attributes [...] if 
> specified, must have values that are valid non-negative integers."
> and
> "A string is a valid non-negative integer if it consists of one or more 
> characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9)."
> So that makes it clear that percentage values are invalid as far as 
> document conformance goes.


> But the UA requirements gives:
> http://www.whatwg.org/specs/web-apps/current-work/complete/rendering.html#dimRendering 
> http://www.whatwg.org/specs/web-apps/current-work/complete/rendering.html#maps-to-the-dimension-property 
> http://www.whatwg.org/specs/web-apps/current-work/complete/common-microsyntaxes.html#rules-for-parsing-dimension-values
> ...which supports percentage values.


On Mon, 8 Nov 2010, Anne van Kesteren wrote:
> The <img> width/height IDL attributes are quite special. So those do not 
> exactly match I think. The ones for <video> probably need some rewording 
> now they are no longer strings.

They just reflect the content attributes. What needs rewording?

On Tue, 9 Nov 2010, Silvia Pfeiffer wrote:
> So, now I am even more confused: are they invalid or supported? How do 
> you reconcile these two seemingly opposing positions?

On Mon, 8 Nov 2010, Simon Pieters wrote:
> They are invalid *and* supported. :-) Defined error handling if you 
> will. It's all over the place in HTML5. See this section:
> http://www.whatwg.org/specs/web-apps/current-work/complete/introduction.html#conformance-requirements-for-authors


On Tue, 9 Nov 2010, Silvia Pfeiffer wrote:
> As long as the percent-values aren't deprecated... cause if they are, IE 
> behavior would be accurate, IMO.

They're more than deprecated, they've never been allowed at all.

The behaviour is as it is purely so that all the height and width 
attributes can be implemented with the same code.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list