From f51425612f6cda7671791ee9980865f920c28def Mon Sep 17 00:00:00 2001 From: fuzhenn Date: Thu, 21 Nov 2024 17:25:44 +0800 Subject: [PATCH] remove testPassive after testing, fix maptalks/issues#793 --- src/core/Browser.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/Browser.ts b/src/core/Browser.ts index 149eee776a..7b56a21897 100644 --- a/src/core/Browser.ts +++ b/src/core/Browser.ts @@ -54,6 +54,9 @@ function getDevicePixelRatio() { return (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)); } +function isPassive() { +} + if (!IS_NODE) { const ua = navigator.userAgent.toLowerCase(), doc = document.documentElement || { style: {} }, @@ -119,13 +122,14 @@ if (!IS_NODE) { /* Add feature test for passive event listener support */ let supportsPassive = false; try { - window.addEventListener('testPassive', () => { - }, { + + window.addEventListener('testPassive', isPassive, { get passive() { supportsPassive = true; return true; } }); + window.removeEventListener('testPassive', isPassive); /*eslint-disable no-empty */ } catch (e) { }