I want to understand how event binding/unbinding works in browsers. Specifically, if I remove an element that already has an event bound to it, using for example jQuery: $("#anElement").remove();
, will the bound event get removed as well?
In other words, if I don't unbind()
the event first, am I creating some sort of memory leak?
Edit: I know that a handler won't be triggered again if an element is removed and then added, but what happens to the handler? Does it still sit somewhere in the browser/DOM?