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.
Yes. It's also filed, last I checked.
-Boris