From b0e653773d7ad8207cc575e3d2608d66f39a5000 Mon Sep 17 00:00:00 2001 From: Keanu Lee Date: Mon, 17 Nov 2014 15:02:30 -0800 Subject: [PATCH] Copy CustomElement's polyfill of CustomEvent to HTMLImports --- src/HTMLImports/boot.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/HTMLImports/boot.js b/src/HTMLImports/boot.js index 090d8e3..f4aadd8 100644 --- a/src/HTMLImports/boot.js +++ b/src/HTMLImports/boot.js @@ -24,16 +24,15 @@ if (scope.useNative) { return; } -// IE shim for CustomEvent +// CustomEvent shim for IE if (typeof window.CustomEvent !== 'function') { - window.CustomEvent = function(inType, dictionary) { - var e = document.createEvent('HTMLEvents'); - e.initEvent(inType, - dictionary.bubbles === false ? false : true, - dictionary.cancelable === false ? false : true, - dictionary.detail); + window.CustomEvent = function(inType, params) { + params = params || {}; + var e = document.createEvent('CustomEvent'); + e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail); return e; }; + window.CustomEvent.prototype = window.Event.prototype; } // Initialize polyfill modules. Note, polyfill modules are loaded but not