CustomEvent polyfill (Fixes #172)
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
// ==========================================================================
|
||||
// Plyr
|
||||
// plyr.js v1.5.15
|
||||
// https://github.com/selz/plyr
|
||||
// License: The MIT License (MIT)
|
||||
// ==========================================================================
|
||||
@ -2832,16 +2833,18 @@
|
||||
// Custom event polyfill
|
||||
// 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: undefined };
|
||||
var evt = document.createEvent('CustomEvent');
|
||||
evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
|
||||
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
||||
return evt;
|
||||
}
|
||||
|
||||
CustomEvent.prototype = window.Event.prototype;
|
||||
|
||||
if(!('CustomEvent' in window)) {
|
||||
window.CustomEvent = CustomEvent;
|
||||
}
|
||||
window.CustomEvent = CustomEvent;
|
||||
})();
|
||||
|
Reference in New Issue
Block a user