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:
<html><head><title>...</title></head>

<body><section>...</section>
<div>...</div></body></html>


Deer Park Alpha 2:
<html><head><title>...</title>

<section></section></head><body>...
<div>...</div></body></html>


Opera 8.02:
<HTML><TITLE>...</TITLE><BODY><section>...</section>
<DIV>...</DIV></BODY></HTML>


IE7 Beta 1:
<HTML><HEAD><TITLE>...</TITLE><SECTION></HEAD>
<BODY>...</SECTION>
<DIV>...</DIV></BODY></HTML>

(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:

<html><head><title>...</title>
<section>...</section>
</head><body><div>...</div></body></html>

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 text=document.createTextNode(document.documentElement.innerHTML);pre.appendChild(text);document.body.appendChild(pre);};go();

--
Lachlan Hunt
http://lachy.id.au/

Reply via email to