Closed Bug 155504 Opened 23 years ago Closed 23 years ago

[FIXr]appendChild during document.write appends twice

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla1.4beta

People

(Reporter: jruderman, Assigned: bzbarsky)

References

()

Details

Attachments

(1 file)

Click the URL link above, which is: javascript:x=window.open(); x.document.write("foo"); x.document.body.appendChild(x.document.createTextNode("bar")); void 0 Result: foobarbar Expected: foobar Workaround: call document.close() before calling appendChild. Works as expected in IE.
The DOM ends up being correct here, but we end up showing "bar" twice. Peterv, the sink context stack n' all that must not be flushed/synced properly here, wanna have a look?
Forgot to mention: selecting the second "bar" with the mouse actually selects the first "bar".
Mass-reassigning bugs to dom_bugs@netscape.com
Assignee: jst → dom_bugs
So the problem, imo, is that the sink's treatment of notifications is just totally whacked. In particular, it assumes that if it's not in a script then any notifications that are generated are caused by itself. This is patently incorrect if another window/frame accesses the DOM during parsing (as here). (And why exactly does the sink not call BeginUpdate itself? Not quite clear on what the deal is there...)
Attachment #121069 - Flags: superreview?(jst)
Attachment #121069 - Flags: review?(heikki)
Attachment #121069 - Flags: review?(heikki) → review+
Comment on attachment 121069 [details] [diff] [review] This fixes this bug for me... Hmm, this seems strangely correct to me, but it still scares me a bit (knowing how many regressions we've had from messing with this code over the years). sr=jst
Attachment #121069 - Flags: superreview?(jst) → superreview+
taking
Assignee: dom_bugs → bzbarsky
OS: Windows 2000 → All
Priority: -- → P1
Hardware: PC → All
Summary: appendChild during document.write appends twice → [FIXr]appendChild during document.write appends twice
Target Milestone: --- → mozilla1.4beta
Checked in.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: