DEV Community

Discussion on: Let's get to know the ResizeObserver 👋🏼

Collapse
 
hozefaj profile image
Hozefa

This seems to be very useful, to watch individual events than event listener at root level.

Collapse
 
cvanpoelje profile image
cvanpoelje

Listeners at root level will cost your app a lot more, especially when you use a lot of them. With the ability to apply them on children instead of root it must be easier to stop the Event listener from listening when the element no longer exists to prevent memory leaks.