Re: DOMObject.firstChild inconsistencies

On Tue, 20 Mar 2007, Dailey, David P. wrote:
> 
> Or, for one simple example, consider the following simple code in which 
> FF and IE return (via alert) "HEAD", but Opera returns "SCRIPT".
> 
> <html>
>       <script>
>       alert(document.documentElement.firstChild.nodeName)
>       </script>
>       <body>Hello</body>
> </html>

This is a known, long-standing bug in Opera. There are in fact a series of 
bugs to do with its handling of <head>. (This isn't even an ambiguity in 
HTML4, like most incompatibilities.)


> The total number of children in a given document is usually entirely 
> different. If we wish to be able to parse a document according to what I 
> surmise are W3C standards, then it would be nice if our browsers could 
> agree on how many nodes there are.

For what it's worth, the WHATWG HTML5 spec does define this precisely:

   http://www.whatwg.org/specs/web-apps/current-work/#parsing

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

Received on Wednesday, 21 March 2007 06:09:03 UTC