Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly set passive to false when binding mouse wheel event listeners #355

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/uniwheel.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ module.exports = (function(){
//Full details: https://developer.mozilla.org/en-US/docs/Web/Reference/Events/wheel

var prefix = "", _addEventListener, _removeEventListener, support, fns = [];
var passiveOption = {passive: true};


// detect event model
if ( window.addEventListener ) {
_addEventListener = "addEventListener";
Expand Down Expand Up @@ -95,7 +94,7 @@ module.exports = (function(){
cb = createCallback(elem, callback);
}

elem[_addEventListener](prefix + eventName, cb, isPassiveListener ? passiveOption : false);
elem[_addEventListener](prefix + eventName, cb, { passive: isPassiveListener ? true : false }, false);
}

function _removeWheelListener(elem, eventName, callback, isPassiveListener ) {
Expand All @@ -108,7 +107,7 @@ module.exports = (function(){
cb = getCallback(elem);
}

elem[_removeEventListener](prefix + eventName, cb, isPassiveListener ? passiveOption : false);
elem[_removeEventListener](prefix + eventName, cb, { passive: isPassiveListener ? true : false }, false);

removeCallback(elem);
}
Expand Down