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
While reviewing #11271, I noticed that we're calling addEventListener for certain bindings without an accompanying removeEventListener. At first I thought we should probably add the removeEventListener, 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:
Remove event listeners, if we do in fact need to
More likely, we can remove some redundant removeEventListener calls, making the library a tiny bit leaner
Importance
nice to have
The text was updated successfully, but these errors were encountered:
It is indeed unnecessary to call removeEventListener in that case, but our code is already optimal with regards to that - no unnecessary calls for any bindings.
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: