- From: Simon Pieters <simonp@opera.com>
- Date: Wed, 18 Jul 2007 15:36:06 +0200
- To: public-html <public-html@w3.org>
On Sun, 15 Jul 2007 23:16:02 +0200, Simon Pieters <simonp@opera.com> wrote: > Shouldn't the HTMLImageElemnet.width and height attributes be unsigned > long instead of long? They are in Opera, Safari and Firefox. In IE, they > are unsigned long limited to only positive non-zero numbers. > > http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A%3Cimg%20width%3D-1%3E%3Cscript%3Ew%28document.body.firstChild.width%29%3C/script%3E > The width and height attributes on HTMLObjectElement and HTMLEmbedElement are also long in the spec. In DOM2 HTML, HTMLIFrameElement also had width and height attributes. http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0D%0A%3Cbody%3E%3Cobject%20width%3D-2%20height%3D-2%3E%3C/object%3E%3Cimg%20width%3D-2%20height%3D-2%3E%3Ciframe%20width%3D-2%20height%3D-2%3E%3C/iframe%3E%3Cembed%20width%3D-2%20height%3D-2%3E%3Cscript%3E%0D%0Avar%20node%20%3D%20document.body.firstChild%3B%0D%0Avar%20str%20%3D%20%22%22%3B%0D%0Awhile%20%28node%20%21%3D%20document.body.lastChild%29%20%7B%0D%0A%20%20str%20+%3D%20node.nodeName%20+%20%22%20width%3D%22%20+%20node.width%20+%20%22%20height%3D%22%20+%20node.height%20+%20%22%5Cr%5Cn%22%3B%0D%0A%20%20node%20%3D%20node.nextSibling%3B%0D%0A%7D%0D%0Aw%28str%29%3B%0D%0A%3C/script%3E http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%3Cbody%3E%3Cobject%20width%3D-2%20height%3D-2%20style%3Dheight%3A100px%3Bwidth%3A100px%3E%3C/object%3E%3Cimg%20width%3D-2%20height%3D-2%20style%3Dheight%3A100px%3Bwidth%3A100px%3E%3Ciframe%20width%3D-2%20height%3D-2%20style%3Dheight%3A100px%3Bwidth%3A100px%3E%3C/iframe%3E%3Cembed%20width%3D-2%20height%3D-2%20style%3Dheight%3A100px%3Bwidth%3A100px%3E%3Cscript%3Evar%20node%20%3D%20document.body.firstChild%3Bvar%20str%20%3D%20%22%22%3Bwhile%20%28node%20%21%3D%20document.body.lastChild%29%20%7Bstr%20+%3D%20node.nodeName%20+%20%22%20width%3D%22%20+%20node.width%20+%20%22%20height%3D%22%20+%20node.height%20+%20%22%20offsetWidth%3D%22%20+%20node.offsetWidth%20+%20%22%20offsetHeight%3D%22%20+%20node.offsetHeight%20+%20%22%5Cr%5Cn%22%3Bnode%20%3D%20node.nextSibling%3B%7Dw%28str%29%3B%3C/script%3E In Opera, negative numbers for HTMLImageElement.width/height are treated as 1, but 0 is treated as 0. The other elements' width/height are long. In Safari, HTMLImageElement.width/height are unsigned long, and the others are long. In Firefox, all are unsigned long. In IE, HTMLIFrameElement.width/height are long, the others are non-zero unsigned long. In all four browsers, HTMLImageElement.width/height are the same as .offsetWidth and .offsetHeight, respectively. -- Simon Pieters Opera Software
Received on Wednesday, 18 July 2007 13:36:18 UTC