diff options
Diffstat (limited to 'app/assets/javascripts/commons/polyfills/event.js')
-rw-r--r-- | app/assets/javascripts/commons/polyfills/event.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/assets/javascripts/commons/polyfills/event.js b/app/assets/javascripts/commons/polyfills/event.js new file mode 100644 index 00000000000..ff5b9a1982f --- /dev/null +++ b/app/assets/javascripts/commons/polyfills/event.js @@ -0,0 +1,18 @@ +/** + * Polyfill for IE11 support. + * new Event() is not supported by IE11. + * Although `initEvent` is deprecated for modern browsers it is the one supported by IE + */ +if (typeof window.Event !== 'function') { + window.Event = function Event(event, params) { + const evt = document.createEvent('Event'); + const evtParams = { + bubbles: false, + cancelable: false, + ...params, + }; + evt.initEvent(event, evtParams.bubbles, evtParams.cancelable); + return evt; + }; + window.Event.prototype = Event; +} |