er = EventTarget.prototype.addEventListener; EventTarget.prototype.addEventListener = function(type, listener, options) { var supportsPassive = false; try { var opts = Object.defineProperty({}, 'passive', { get: function() { supportsPassive = true; return false; } }); window.addEventListener('testPassive', null, opts); window.removeEventListener('testPassive', null, opts); } catch (e) {} // Apply passive: false for touch and wheel events to prevent warnings if (supportsPassive && (type === 'touchstart' || type === 'touchmove' || type === 'wheel' || type === 'mousewheel')) { if (typeof options === 'boolean') { options = { capture: options, passive: false }; } else if (typeof options === 'object' && options !== null) { options.passive = false; } else { options = { passive: false }; } } return originalAddEventListener.call(this, type, listener, options); }; } })();