From 14fb46647d492163fbae616b4a6212bc17926398 Mon Sep 17 00:00:00 2001 From: Alexandra Qin Date: Wed, 13 Aug 2014 11:59:13 -0400 Subject: [PATCH] Add customEvent polyfill for IE9-10 --- EventListener.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/EventListener.js b/EventListener.js index 177ce91..5d9182d 100644 --- a/EventListener.js +++ b/EventListener.js @@ -142,4 +142,16 @@ this.Element && Element.prototype.attachEvent && !Element.prototype.addEventList return event; }; -})(); \ No newline at end of file +})(); + +// polyfill for IE9-10 taken from https://gist.github.com/james2doyle/7945320 +(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.CustomEvent.prototype; + window.CustomEvent = CustomEvent; +})();