https://developer.mozilla.org/en/DOM/el ... ory_issues
The MDC says that this is wrong:
A common way for one to stumble upon increasing memory problems is to pass an object's method as a callback:
Code: Select all
document.addEventListener("load", obj.func, false); // sets wrong |this|!
and the correct way is:
Code: Select all
document.addEventListener("load", function(event) { obj.func(event); }, false);
I need how to Call removeEventListener or removing all references to an anonymous function
this doesnt work to me:
document.removeEventListener("load", function(event) { obj.func(event); }, false);