Re: Adding DOM Mutation listeners to different DOMs correspoding to each open tab in Firefox.

Jonas Sicking <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Message-ID <[email protected]>
stony_dreams wrote:
> Thanks for the help... Just one small question, if i call the following line
> MULTIPLE TIMES for a current DOM:
> 
> content.document.addEventListener("DOMNodeInserted", domNodeInserted,
> false);
> 
> And then I call the removeEventListener as follows:
> 
> content.document.removeEventListener("DOMNodeInserted", domNodeInserted,
> false);
> 
> Then is there some proper ordering (For Eg: stack etc) in which the event
> listeners are removed? Or is it random cuz I have the same handler added as
> an event listener multiple times for a particular event?
> 
> Thanks in advance...

Adding the same listener multiple times has the exact same effect as 
adding it once. So if you add it 10 times and remove it once, it will be 
fully removed.

This is per the DOM spec:

http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget-addEventListener

Hope that helps.

/ Jonas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.