body and head element just disappears when inserted through innerHTML

[email protected]
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <4610de5c-9d3b-471a-ae0a-f7806bbb1a1b@t54g2000hsg.googlegroups.com>
Whats going on here?

I tried these on http://www.google.com BTW.

The following line works correctly.

javascript: document.write( "<head><title> Simple document </title> </
head> <body> <div>The text of the document goes here.</div></body>");
void 0;

If I do the following, the body and head elements disappears in the
DOM Inspector. The innerHTML result also has the body and head
missing.

javascript: document.body.parentNode.innerHTML = "<head><title> Simple
document </title> </head> <body> <div>The text of the document goes
here.</div></body>"; void 0;

Here is an example of how the source changes and a different path to
the element (same result tho).

javascript: alert(window.document.documentElement.innerHTML =
"<head><title> Simple document </title> </head> <body> <div>The text
of the document goes here.</div></body>");
alert(window.document.documentElement.innerHTML); void 0;

How can the body and head element just disappear like that? Is this a
bug? Is my code wrong? Is it a bug that innerHTML works on an HTML
element and standards wise its not supposed to?

This was tested on Firefox 2.0.0.16 and 1.5.0.12.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.