Skip to content

Instantly share code, notes, and snippets.

@dmitriybevz2
Last active August 9, 2018 15:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitriybevz2/33396285d26b71600ec36f65d9e21a80 to your computer and use it in GitHub Desktop.
Save dmitriybevz2/33396285d26b71600ec36f65d9e21a80 to your computer and use it in GitHub Desktop.
try {
new CustomEvent("IE has CustomEvent, but doesn't support constructor");
} catch (e) {
window.CustomEvent = function(event, params) {
var evt;
params = params || {
bubbles: false,
cancelable: false,
detail: undefined
};
evt = document.createEvent("CustomEvent");
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
};
CustomEvent.prototype = Object.create(window.Event.prototype);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment