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)
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.
Comment 1•24 years ago
|
||
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.
Target Milestone: --- → Future
Reporter | ||
Updated•24 years ago
|
Updated•24 years ago
|
Component: DOM Level 2 → DOM HTML
Reporter | ||
Comment 3•23 years ago
|
||
If I remove "about:blank" and instead pass no parameters to window.open, it works.
Reporter | ||
Updated•22 years ago
|
Summary: effect of window.open().document.body.appendChild() is transient → effect of window.open("about:blank").document.body.appendChild() is transient
Comment 5•19 years ago
|
||
This is still a problem in current trunk build.
Reporter | ||
Comment 6•19 years ago
|
||
Actually, it got worse, probably with split window but maybe with fastback. Now
both bookmarklets in comment 0 fail.
Comment 7•19 years ago
|
||
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
You need to log in
before you can comment on or make changes to this bug.
Description
•