进行了一些小修复

This commit is contained in:
2026-08-26 17:24:37 +08:00
parent 5121b33ad5
commit bfc16de962
6 changed files with 13 additions and 68 deletions
File diff suppressed because one or more lines are too long
-25
View File
@@ -1,25 +0,0 @@
/**
* Passive event listener polyfill
*
* Patches addEventListener so scroll-blocking events (touchstart, touchmove,
* wheel, mousewheel) default to { passive: true } unless explicitly set to
* false. Eliminates Chrome Violation warnings from third-party libraries.
*/
(function () {
'use strict';
var opts = Object.defineProperty({}, 'passive', {
get: function () { window.__passiveSupported = true; }
});
window.addEventListener('test', null, opts);
if (!window.__passiveSupported) return;
var orig = EventTarget.prototype.addEventListener;
var passiveEvents = { touchstart: 1, touchmove: 1, wheel: 1, mousewheel: 1 };
EventTarget.prototype.addEventListener = function (type, listener, options) {
if (passiveEvents[type] && typeof options !== 'object') {
options = { passive: true, capture: options };
}
orig.call(this, type, listener, options);
};
})();