When registering an event via addEventListener on an element, then delete that element without removing the event, and doing so repeatedly, would memory be “leaked”?
When registering an event via addEventListener on an element, then delete that element without
Share
It shouldn’t leak. The one browser that’s infamous for leaking like hell when an event handler causes a host-object<>JS-object loop is IE (up to version 7), and IE (up to version 8) doesn’t support
addEventListener.Leave this running and see how the browser’s memory usage is affected in the long term, if you want to test it in a particular browser.
(To test it with a reference loop present, move the
function clickdefinition up into thereplacebody.)