The default bug view has changed. See this FAQ.

[FIXr]appendChild during document.write appends twice

RESOLVED FIXED in mozilla1.4beta

Status

()

Core
DOM: Core & HTML
P1
minor
RESOLVED FIXED
15 years ago
14 years ago

People

(Reporter: Jesse Ruderman, Assigned: bz)

Tracking

Trunk
mozilla1.4beta
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

15 years ago
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?
(Reporter)

Comment 2

15 years ago
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...)
Created attachment 121069 [details] [diff] [review]
This fixes this bug for me...
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
Last Resolved: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.