Answered: Do Event Listeners take space in DOM?
Case: I have 5 containers inside vbox layout in a parent container. I attach listeners for tap event on each of the 5 child containers. Another way proposed is to add one event listener on the parent container, because apparently it lightens the DOM.
- Do Event Listeners take space in DOM?
- If I put the event listener on the parent container only, how do I know which child container was clicked?
Posted by mitchellsimoens
Event listeners do not take up space in the DOM. They will take up some space in memory. If you can use just 1 listener then you will get a small performance increase over using 5 listeners.