You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to the way the removed event handler is set and cleaned up, the last registered removed event will always be the one that is called and then removed. This causes a memory leak since the second handler is never turned off().
Here is an example:
var $el = $("<div>");
var teardownOne = function() { ... }; // this will be called
var teardownTwo = function() { ... }; // this will not be called
domEvents.addEventListener.call($el[0], "removed", teardownOne);
domEvents.addEventListener.call($el[0], "removed", teardownTwo);
domEvents.removeEventListener.call($el[0], "removed", teardownOne);
...
$el.remove();
The text was updated successfully, but these errors were encountered:
phillipskevin
changed the title
Memory leak with multiple event handlers on the same element
Memory leak with multiple removed handlers on the same element
Apr 26, 2017
phillipskevin
changed the title
Memory leak with multiple removed handlers on the same element
Memory leak with multiple removed handlers on the same element
Apr 26, 2017
Due to the way the
removed
event handler is set and cleaned up, the last registeredremoved
event will always be the one that is called and then removed. This causes a memory leak since the second handler is never turnedoff()
.Here is an example:
The text was updated successfully, but these errors were encountered: