On 2 November 2013 15:28, David Bruant <bruan...@gmail.com> wrote: >> function f(e){tellSomebodyAboutTheEvent(x);} >> >> (function(){ >> var iframe = document.getElementByTagName('iframe')[0]; >> iframe.addEventListener('someEvent', f); >> })() >> > There is a point in your program in which you know that 'iframe' won't be > needed anymore and you do something about that. Maybe you clear a given data > structure, maybe you remove the iframe from the document without assigning > it to a variable, maybe you do something else, but you do do something. > It's at this point that either you want to remove the listener or reassign x > to another value.
A library author may have little control over how iframe is used. A caller may use another library that caches all iframes for some purposes etc. However, I suspect that a lot of problems for library authors can go away if JS provides API like removeAllEventListeners. _______________________________________________ dev-tech-js-engine-internals mailing list dev-tech-js-engine-internals@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals