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

Simon Pieters simonp at opera.com
Mon Nov 8 05:16:35 PST 2010

On Mon, 08 Nov 2010 08:27:30 +0100, Silvia Pfeiffer  
<silviapfeiffer1 at gmail.com> wrote:

> Hi all,
> 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.

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.

> I am now wondering if a percentage value is correct,

Following the link for <video width> I come to


which says

"Author requirements: The width and height attributes [...] if specified,  
must have values that are valid non-negative integers."


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


...which supports percentage values.

> 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?

It was DOMString for video in the spec initially (for consistency with  
iframe, embed and object) but for some reason we all implemented it as  
unsigned long instead, so the spec was changed to match implementations.  

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

<img> has the same rules as <video>.

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

Seems like a bug.

> Thanks,
> Silvia.
> [1]http://www.w3.org/TR/2008/WD-WebIDL-20080829/#idl-unsigned-long
> Cheers,
> Silvia.

Simon Pieters
Opera Software

More information about the whatwg mailing list