[whatwg] On tag inference

Lachlan Hunt lachlan.hunt at lachy.id.au
Mon Sep 5 07:46:07 PDT 2005

Henri Sivonen wrote:
> On Sep 5, 2005, at 13:10, Lachlan Hunt wrote:
>> Henri Sivonen wrote:
>>> My tentative assumption has been
>>> <!DOCTYPE html>
>>> <html><head><title>...</title>
>>> </head><body><section>...</section>
>>> <div>...</div></body></html>
>> That is how I would recommend it be defined.  It's not what Firefox 
>> does (that's the easiest browser to get the DOM source from)
> That's weird.
> I tested http://hsivonen.iki.fi/test/inference/section.html in Mozilla 
> 1.7.5 and Safari 1.3 and in both cases SECTION appears as the first 
> child of body. (A DOM viewer for Opera would be nice. :-)

Ok, it seems Gecko has changed behaviour between Firefox 1.0.6 and Deer 
Park Alpha 2.  I incorrectly assumed they'd be the same and just wrote 
firefox out of habit.  However, for your test case, these are the 
results for all browsers I could test:

Firefox 1.0.6:


Deer Park Alpha 2:


Opera 8.02:

IE7 Beta 1:

(That's very wierd, IE just loves producing broken DOMs! :-/  I assume 
IE6 will produce a similar result, though I don't have it available to test)

Netscape 4.75:

Note: I couldn't actually get the DOM, but from the output, I think it's 
safe to assume the DOM is generated as something like this:


Netscape only output the content of the <div> and left the contents of 
the head hidden.  Therefore, since the <section> element wasn't output, 
it must have been within the <head>.  However, when I inserted a <body> 
start-tag before it, or moved the section after the <div>, then it's 
content was output.

For Opera and IE, I used this bookmarklet to output the innerHTML of 
<html>, then just added the <HTML> and </HTML> manually.

javascript:function go() {var pre = document.createElement("pre");var 

Lachlan Hunt

More information about the whatwg mailing list