3 ms·
It depends. For elements that are removed from the DOM, then yes, the event listener should also be automatically removed: https://jakearchibald.com/2020/events
by nolanl 5y ago
It depends. For elements that are removed from the DOM, then yes, the event listener should also be automatically removed: https://jakearchibald.com/2020/events-and-gc/ https://jakearchibald.com/2020/events-and-gc/
However, if you're adding event listeners to the document, the window, or some permanent element (header, footer, etc.), then those won't be GC'ed since the DOM node is never GC'ed.