Computing document.width.baseVal on an empty SVG document

www-svg,

I hit a small bug today where the spec isn't clear. What should width
return in the following case?

<svg xmlns="http://www.w3.org/2000/svg">
<script><![CDATA[
alert(document.documentElement.width.baseVal.value);
]]></script>
</svg>

Gecko returns 1
Blink throw an exception
Trident returns the viewport's width

I think Trident's behavior is the most intuitive. If you add a <rect> to
the document with 100% width and height, the width will resolve to the
viewport's width.

Philip

Received on Wednesday, 14 August 2013 23:02:34 UTC