Closed Bug 261818 Opened 20 years ago Closed 20 years ago

[FIXr]Mutation events not fired for the first node inserted into an XML document

Categories

(Core :: XML, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.8alpha5

People

(Reporter: jwkbugzilla, Assigned: bzbarsky)

Details

Attachments

(3 files)

Weird things happen with the event handlers when you modify an XML document that
is loaded into the iframe. In particular, for the first node to be inserted into
this document mutation events don't seem to bubble.
Attached file Testcase
This attachment loads an empty XML document and inserts two XML nodes. An event
listener is added to the document root to watch over attribute changes. For the
attribute change in the second element the alert pops up correctly, for the
first one it doesn't. However, if you add the listener directly to the node,
the alert will appear - the event is there, it just doesn't bubble.
So... the problem here is that the first node that's inserted has an insertion
parent, according to the binding manager.  This happens because the prettyprint
binding is in effect when the node is inserted.  When the binding is dropped,
for some reason things are not cleared properly.

So the point is that the event captures up to the insertion parent, not the
actual parent.

The second node inserted into the document has a null insertion parent, so
things capture up to the parent correctly.

If I prevent prettyprinting from kicking in (eg by sticking an XHTML-namespaced
node into the document), things work fine.
Assignee: events → hjtoi-bugzilla
Component: DOM: Events → XML
QA Contact: ian → ashshbhatt
Comment on attachment 160874 [details] [diff] [review]
Make sure to clear the insertion parent entries properly

The nsXBLService change is random cleanup I found while making sure that
aOldDocument wouldn't be null in ChangeDocument.
Attachment #160874 - Flags: superreview?(jst)
Attachment #160874 - Flags: review?(bryner)
Comment on attachment 160874 [details] [diff] [review]
Make sure to clear the insertion parent entries properly

sr=jst
Attachment #160874 - Flags: superreview?(jst) → superreview+
Attachment #160874 - Flags: review?(bryner) → review+
Assignee: hjtoi-bugzilla → bzbarsky
Priority: -- → P1
Summary: Mutation events not fired for the first node inserted into an XML document → [FIXr]Mutation events not fired for the first node inserted into an XML document
Target Milestone: --- → mozilla1.8alpha5
Fixed.
Status: NEW → RESOLVED
Closed: 20 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: