W3C home > Mailing lists > Public > public-html@w3.org > July 2007

document.body (detailed review of the DOM)

From: Simon Pieters <simonp@opera.com>
Date: Fri, 13 Jul 2007 13:59:11 +0200
To: public-html <public-html@w3.org>
Message-ID: <op.tvejkx1eidj3kv@hp-a0a83fcd39d2>

(This is part of my detailed review of the Document Object Model section.)

    http://simon.html5.org/test/html/dom/interfaces/HTMLDocument/body/

In IE and Opera, getting document.body returns the first body or frameset  
element in the document. In Firefox and Safari, it returns a body or  
frameset element that is child of the html root element. But it's not  
necessarily the first one. I haven't figured out what Firefox and Safari  
are doing exactly though.


In IE, document.body is readonly.

In Firefox, setting document.body raises an exception if the new value  
isn't a <body> or <frameset> element (like the spec says). However, if the  
existing document.body is a <frameset> element, the new value is appended  
to the root element.

In Safari, setting document.body raises an exception if the new value  
isn't an element. (Otherwise per spec.)

In Opera, setting document.body rasies an exception if the new value isn't  
a <body> element. If the existing document.body is a <frameset> element,  
the new value is appended to the root element.


I think the spec should be aligned with what IE and Opera do on getting,  
i.e. return the first body or frameset element in the document. I think  
the spec is fine for setting.

-- 
Simon Pieters
Opera Software
Received on Friday, 13 July 2007 12:14:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:02 GMT