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; -}()); +}