Do I have to manually remove event listeners in the PluginView?

I created some elements using document.createElement() in the constructor of my pluginView. And then I added event listeners to them.

Is it necessary to remove their event listeners in the destroyed() method? or are they literally get removed so I don’t have to take care of the listeners.

If you remove the elements that have the event handlers from the DOM, any browser more recent than IE6 will clean up the handlers for you.

1 Like