Svelte 5: is removeEventListener
necessary for bindings?
#11279
Milestone
removeEventListener
necessary for bindings?
#11279
Describe the problem
While reviewing #11271, I noticed that we're calling
addEventListener
for certain bindings without an accompanyingremoveEventListener
. At first I thought we should probably add theremoveEventListener
, but then it occurred to me that the event listeners exist for the full lifetime of the element — after it gets removed from the DOM, it should be GC'd along with its event handlers.Is that true though? Is it safe not to remove event listeners?
Describe the proposed solution
We should do one of two things:
removeEventListener
calls, making the library a tiny bit leanerImportance
nice to have
The text was updated successfully, but these errors were encountered: