Apparently, doing element.addEventListener on every on:<event> attribute will increase the memory consumption compared where you put every logic in window.addEventListener. Instead of listening globally, we can listen all events in the ShadowRoot scope (i.e this.#shadow.addEventListener(/*filter by element and class method*/))
Apparently, doing
element.addEventListener
on everyon:<event>
attribute will increase the memory consumption compared where you put every logic inwindow.addEventListener
. Instead of listening globally, we can listen all events in the ShadowRoot scope (i.ethis.#shadow.addEventListener(/*filter by element and class method*/)
)