If you look at listeners.js#L30 and listeners.js#L41 you'd see that in both addEventListener and removeEventListener listeners patches the call for the native functions rely on this being the this value of the call.
So if you call {window/document/document.body}.{addEventListener/removeEventListener}('some_event', () => {}) it'll work, but if you do {addEventListener/removeEventListener}('some_event', () => {}) the this will resolve to undefined even though it should be window.
If you look at listeners.js#L30 and listeners.js#L41 you'd see that in both
addEventListener
andremoveEventListener
listeners patches the call for the native functions rely onthis
being the this value of the call.So if you call
{window/document/document.body}.{addEventListener/removeEventListener}('some_event', () => {})
it'll work, but if you do{addEventListener/removeEventListener}('some_event', () => {})
thethis
will resolve toundefined
even though it should bewindow
.This needs to be fixed.