Re: Adding DOM Mutation listeners to different DOMs correspoding to each open tab in Firefox.
"Nickolay Ponomarev" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
On Feb 8, 2008 10:09 AM, Amit Saurav <[email protected]> wrote: > Thats a W3C recommendation... is that surely the way how its > implemented in Mozilla? > Yes, but are you sure "content" is the same for all the multiple calls you make to content.document.addEventListener? It looks like it isn't and you're getting confused about which content DOMs you added your listener to. Nickolay > > On Feb 8, 2008 12:30 AM, Jonas Sicking <[email protected]> wrote: > > 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 > > > > _______________________________________________ > > dev-tech-dom mailing list > > [email protected] > > https://lists.mozilla.org/listinfo/dev-tech-dom > > > _______________________________________________ > dev-tech-dom mailing list > [email protected] > https://lists.mozilla.org/listinfo/dev-tech-dom >