From 70ce2bf293d0abc0a4eab1b695764beb11dc90f8 Mon Sep 17 00:00:00 2001 From: Treecat Date: Tue, 11 Apr 2023 13:57:25 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-14316=20chore:=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/polyfill/event.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/fineui/src/polyfill/event.js b/packages/fineui/src/polyfill/event.js index 346ec16c8..decca0f7f 100644 --- a/packages/fineui/src/polyfill/event.js +++ b/packages/fineui/src/polyfill/event.js @@ -1,9 +1,9 @@ -(function () { - if (typeof window.CustomEvent === "function") return false; // If not IE +const isIE = () => typeof window.CustomEvent !== "function"; - function CustomEvent (event, params) { +if (isIE()) { + function CustomEvent(event, params) { params = params || { bubbles: false, cancelable: false, detail: undefined }; - var evt = document.createEvent("CustomEvent"); + const evt = document.createEvent("CustomEvent"); evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); return evt; @@ -12,4 +12,4 @@ CustomEvent.prototype = window.Event.prototype; window.CustomEvent = CustomEvent; -}()); +}