diff options
-rw-r--r-- | app/assets/javascripts/commons/polyfills/custom_event.js | 5 | ||||
-rw-r--r-- | app/assets/javascripts/commons/polyfills/event.js | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/app/assets/javascripts/commons/polyfills/custom_event.js b/app/assets/javascripts/commons/polyfills/custom_event.js index 8fd41fdd8dc..db51ade61ae 100644 --- a/app/assets/javascripts/commons/polyfills/custom_event.js +++ b/app/assets/javascripts/commons/polyfills/custom_event.js @@ -1,11 +1,12 @@ if (typeof window.CustomEvent !== 'function') { window.CustomEvent = function CustomEvent(event, params) { const evt = document.createEvent('CustomEvent'); - const evtParams = Object.assign({}, params, { + const evtParams = { bubbles: false, cancelable: false, detail: undefined, - }); + ...params, + }; evt.initCustomEvent(event, evtParams.bubbles, evtParams.cancelable, evtParams.detail); return evt; }; diff --git a/app/assets/javascripts/commons/polyfills/event.js b/app/assets/javascripts/commons/polyfills/event.js index 50c7644f27d..ff5b9a1982f 100644 --- a/app/assets/javascripts/commons/polyfills/event.js +++ b/app/assets/javascripts/commons/polyfills/event.js @@ -6,7 +6,11 @@ if (typeof window.Event !== 'function') { window.Event = function Event(event, params) { const evt = document.createEvent('Event'); - const evtParams = Object.assign({}, params, { bubbles: false, cancelable: false }); + const evtParams = { + bubbles: false, + cancelable: false, + ...params, + }; evt.initEvent(event, evtParams.bubbles, evtParams.cancelable); return evt; }; |