About events: a nice trick is to add event listeners to the window only and check the event.target.
This method is used in game dev a lot.
This method is used in game dev a lot.
I think the more expensive cost is cleanup, or lack of proper cleanup leading to memory leaks... I'll usually detach nodes to cleanup, and put them into a queue that's run in a setTimeout loop... that way they don't slow down the UI.