Skip to content

Instantly share code, notes, and snippets.

@chambaz
Created March 24, 2014 17:07
Show Gist options
  • Save chambaz/9744586 to your computer and use it in GitHub Desktop.
Save chambaz/9744586 to your computer and use it in GitHub Desktop.
Polyfill for CustomEvent() constructor functionality in Internet Explorer 9 and 10
(function () {
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;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment