diff --git a/CHANGES.md b/CHANGES.md index 3460ca10c..cae43b351 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,7 +4,6 @@ - Avoid `eval` (via `_.template` from lodash). - Don't show bookmark toggles when PEP bookmarking not supported by the XMPP server. -- Add LibreJS support ### Bugfixes @@ -12,6 +11,7 @@ - Bookmarks list and open rooms list weren't recreated after logging in for a 2nd time (without reloading the browser). - #1024 null reference on MUC Invite - #1025 OTR lock icon disappears +- #1027 `new Event` not supported in IE11 ## 3.3.3 (2018-02-14) diff --git a/src/converse-core.js b/src/converse-core.js index 387d47b89..c9577e85b 100644 --- a/src/converse-core.js +++ b/src/converse-core.js @@ -2051,6 +2051,6 @@ 'utils': u } }; - window.dispatchEvent(new Event('converse-loaded')); + window.dispatchEvent(new CustomEvent('converse-loaded')); return window.converse; })); diff --git a/src/polyfill.js b/src/polyfill.js index 779a9c3f4..3ec370349 100644 --- a/src/polyfill.js +++ b/src/polyfill.js @@ -1,3 +1,14 @@ +function CustomEvent ( event, params ) { + params = params || { bubbles: false, cancelable: false, detail: undefined }; + var evt = document.createEvent( 'CustomEvent' ); + evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); + return evt; +} +if ( typeof window.CustomEvent !== "function" ) { + CustomEvent.prototype = window.Event.prototype; + window.CustomEvent = CustomEvent; +} + if (!String.prototype.includes) { String.prototype.includes = function(search, start) { 'use strict'; diff --git a/tests/transpiled.html b/tests/transpiled.html index 1452713a6..c6de8e291 100644 --- a/tests/transpiled.html +++ b/tests/transpiled.html @@ -4,15 +4,15 @@ Converse.js Tests - + - - - - + + + + - - + +