willmcpo / body-scroll-lock

Body scroll locking that just works with everything 😏
MIT License
4.04k stars 339 forks source link

remove document.removeEventListener passive attribute. #201

Closed GeorgeHulpoi closed 3 years ago

GeorgeHulpoi commented 3 years ago

You can remove where removeEventListener uses passive attribute at options.

document.removeEventListener('touchmove', this.PreventDefault.bind(this), this.hasPassiveEvents ? { passive: false } : undefined);

The main reason is that removeEventListener doesn't have that property: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener

And removeEventListener uses the interface EventListenerOptions for options, and it doesn't have property passive as well. https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.eventlisteneroptions.html

diachedelic commented 3 years ago

From that page, it suggests erring on the side of caution:

It's worth noting that some browser releases have been inconsistent on this, and unless you have specific reasons otherwise, it's probably wise to use the same values used for the call to addEventListener() when calling removeEventListener().