If a DOM Element is removed, are its listeners also removed from memory in javascript?


In modern browsers, if a DOM Element is removed, its listeners are also removed from memory in javascript.

Note that this will happen ONLY if the element is reference-free. Or in other words, it doesn't have any reference and can be garbage collected. Only then its event listeners will be removed from memory.

Updated on: 02-Dec-2019

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements