diff --git a/lib/utils/gestures.html b/lib/utils/gestures.html index be74db8e90..6b62bdc688 100644 --- a/lib/utils/gestures.html +++ b/lib/utils/gestures.html @@ -62,9 +62,13 @@ /** * Generate settings for event listeners, dependant on `Polymer.passiveTouchGestures` * + * @param {string} eventName Event name to determine if `{passive}` option is needed * @return {{passive: boolean} | undefined} Options to use for addEventListener and removeEventListener */ - function PASSIVE_TOUCH() { + function PASSIVE_TOUCH(eventName) { + if (isMouseEvent(eventName) || eventName === 'touchend') { + return; + } if (HAS_NATIVE_TA && SUPPORTS_PASSIVE && Polymer.passiveTouchGestures) { return {passive: true}; } else { @@ -481,8 +485,7 @@ gobj[dep] = gd = {_count: 0}; } if (gd._count === 0) { - let options = !isMouseEvent(dep) && dep !== 'touchend' && PASSIVE_TOUCH(); - node.addEventListener(dep, this._handleNative, options); + node.addEventListener(dep, this._handleNative, PASSIVE_TOUCH(dep)); } gd[name] = (gd[name] || 0) + 1; gd._count = (gd._count || 0) + 1; @@ -515,8 +518,7 @@ gd[name] = (gd[name] || 1) - 1; gd._count = (gd._count || 1) - 1; if (gd._count === 0) { - let options = !isMouseEvent(dep) && dep !== 'touchend' && PASSIVE_TOUCH(); - node.removeEventListener(dep, this._handleNative, options); + node.removeEventListener(dep, this._handleNative, PASSIVE_TOUCH(dep)); } } }