M
Matt Kruse
I have a reference to a DOM node. I want to know when it is removed
from the document, even if it was caused by a PARENT node being
removed!
(Firefox 3.5+, Chrome, Safari, Opera, don't care about IE)
I'll cover the obvious:
1) DOMNodeRemovedFromDocument: Doesn't bubble, and only fires on the
actual element removed, rather than for all children.
2) DOMNodeRemoved: Bubbles, so I can attach at document level, but
also doesn't fire on child elements
3) Catch one of the events above, then use querySelector() to see if
my child element is contained in it. But I can't query on an object
reference, so I would need a unique ID on the node, which I may not
have
4) I can do querySelectorAll('*') and manually look through all the
child nodes, but that seems so inefficient!
Any suggestions?
Matt Kruse
from the document, even if it was caused by a PARENT node being
removed!
(Firefox 3.5+, Chrome, Safari, Opera, don't care about IE)
I'll cover the obvious:
1) DOMNodeRemovedFromDocument: Doesn't bubble, and only fires on the
actual element removed, rather than for all children.
2) DOMNodeRemoved: Bubbles, so I can attach at document level, but
also doesn't fire on child elements
3) Catch one of the events above, then use querySelector() to see if
my child element is contained in it. But I can't query on an object
reference, so I would need a unique ID on the node, which I may not
have
4) I can do querySelectorAll('*') and manually look through all the
child nodes, but that seems so inefficient!
Any suggestions?
Matt Kruse