Closed Bug 242348 Opened 22 years ago Closed 20 years ago

DOMAttrModified does not work if added before insertion

Categories

(Core :: DOM: Events, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: erik, Unassigned)

References

Details

Attachments

(1 file)

If an element is created using document.createElement and then a mutation event listener is added to the element before it is inserted into the document the mutation event is never fired. If another mutation event listener is added (to any node in the document?) after the node is added all the added event listeners work.
Looking at http://lxr.mozilla.org/mozilla/source/content/events/src/nsEventListenerManager.cpp#665 it seems we are using content.document where we really should use target.ownerDocument. This might be an issue if the node is never inserted and we therefore have turned on mutation events, but it should be better than checking for mutation event listeners when inserting nodes. (Maybe document = do_QueryInterface(mTarget); is actually returning the ownerDocument? My Gecko knowledge is pretty limited...)
No, you're right. We should be using ownerDocument there. All the more reason to have GetOwnerDoc() on nsIContent....
Depends on: 27382
This should work now...
Yes, this works now, so this is fixed by bug 27382, right?
Probably fixed by one of the fixes we did to use GetOwnerDoc(), yeah...
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: