Closed Bug 62517 Opened 24 years ago Closed 19 years ago

effect of window.open("about:blank").document.body.appendChild() is transient

Categories

(Core :: DOM: Core & HTML, defect, P3)

x86
Windows 98
defect

Tracking

()

RESOLVED INVALID
Future

People

(Reporter: jruderman, Unassigned)

References

Details

(Keywords: dom2)

When you run the following bookmarklet, a new window opens and the text "this is a text node" flashes in the new window for a split-second. It should stay there after it's added. javascript:void(window.open("about:blank").document.body.appendChild (document.createTextNode("this is a text node"))); It seems like the document object in the new window is being replaced, because the first of these bookmarklets works and the second doesn't: // open a new window, then do stuff to the window's document's body one second // later javascript:x = window.open("about:blank"); window.setTimeout ('x.document.body.appendChild(document.createTextNode("this is a text node"))', 1000); void(0); // open a new window and grab its document, then do stuff to the document's // body one second later. javascript:x = window.open("about:blank").document; window.setTimeout ('x.body.appendChild(document.createTextNode("this is a text node"))', 1000); void(0); I wonder why this is a problem for document.body.appendChild() but not for document.write(). Btw, IE crashes on equivalent code using appendNode instead of appendChild.
This bug has been marked "future" because the original netscape engineer workingon this is over-burdened. If you feel this is an error, that you or another known resource will be working on this bug,or if it blocks your work in some way -- please attach your concern to the bug for reconsideration.
The problem with the URL field in this bug is probably bug 45784.
Keywords: dom2
Component: DOM Level 2 → DOM HTML
If I remove "about:blank" and instead pass no parameters to window.open, it works.
Summary: effect of window.open().document.body.appendChild() is transient → effect of window.open("about:blank").document.body.appendChild() is transient
Mass-reassigning bugs.
Assignee: jst → dom_bugs
This is still a problem in current trunk build.
Actually, it got worse, probably with split window but maybe with fastback. Now both bookmarklets in comment 0 fail.
window.open is async. So it opens the window, then starts an async load of the document. If you mess with the contents of the window during this period, the changes will persist until the document that's loading actually loads and wipes them out. You probably want to set an onload handler that does the work you want here...
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
Component: DOM: HTML → DOM: Core & HTML
QA Contact: vidur → general
You need to log in before you can comment on or make changes to this bug.