[BUGFIX] Support CustomEvent in IE
This commit is contained in:
parent
7fa0c5e522
commit
a30d12312a
@ -15,7 +15,7 @@ define(function () {
|
|||||||
el.appendChild(sidebar);
|
el.appendChild(sidebar);
|
||||||
|
|
||||||
var button = document.createElement('button');
|
var button = document.createElement('button');
|
||||||
var visibility = new Event('visibility');
|
var visibility = new CustomEvent('visibility');
|
||||||
sidebar.appendChild(button);
|
sidebar.appendChild(button);
|
||||||
|
|
||||||
button.classList.add('sidebarhandle');
|
button.classList.add('sidebarhandle');
|
||||||
|
18
polyfill.js
18
polyfill.js
@ -30,3 +30,21 @@ if (typeof Object.assign !== 'function') {
|
|||||||
return to;
|
return to;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line consistent-return
|
||||||
|
(function () {
|
||||||
|
if (typeof window.CustomEvent === 'function') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomEvent.prototype = window.Event.prototype;
|
||||||
|
|
||||||
|
window.CustomEvent = CustomEvent;
|
||||||
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user