jQuery - Add support for passive event listeners

PHOTO EMBED

Wed May 10 2023 07:28:06 GMT+0000 (Coordinated Universal Time)

Saved by @mastaklance

// Passive event listeners
jQuery.event.special.touchstart = {
    setup: function( _, ns, handle ) {
        this.addEventListener("touchstart", handle, { passive: !ns.includes("noPreventDefault") });
    }
};
jQuery.event.special.touchmove = {
    setup: function( _, ns, handle ) {
        this.addEventListener("touchmove", handle, { passive: !ns.includes("noPreventDefault") });
    }
};
content_copyCOPY

https://gist.github.com/ApoGouv/a4c81c12884b3ddc9bf6c876da487e41