diff --git a/src/gridstack-poly.js b/src/gridstack-poly.js index 3f69a3a92..5ec62d795 100644 --- a/src/gridstack-poly.js +++ b/src/gridstack-poly.js @@ -5,6 +5,22 @@ * gridstack.js may be freely distributed under the MIT license. */ +// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent +(function () { + if (typeof window.CustomEvent === "function") { + return false; + } + + function CustomEvent (event, params) { + params = params || {bubbles: false, cancelable: false, detail: null}; + var evt = document.createEvent('CustomEvent'); + evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); + return evt; + } + + window.CustomEvent = CustomEvent; +})(); + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN Number.isNaN = Number.isNaN || function isNaN(input) { return typeof input === 'number' && input !== input;