From 191464c98c5fc8787a0ba8b847d802cffafee9ab Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Wed, 7 May 2014 13:40:28 -0500 Subject: [PATCH] fix(CustomEvent): fix IE CustomEvent polyfill #1131 #1231 #861 --- js/utils/events.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/js/utils/events.js b/js/utils/events.js index dd2229173f..5d71de169a 100644 --- a/js/utils/events.js +++ b/js/utils/events.js @@ -13,9 +13,10 @@ (function(ionic) { // Custom event polyfill - ionic.CustomEvent = window.CustomEvent || (function() { - var CustomEvent; - CustomEvent = function(event, params) { + ionic.CustomEvent = (function() { + if( typeof window.CustomEvent === 'function' ) return CustomEvent; + + var customEvent = function(event, params) { var evt; params = params || { bubbles: false, @@ -35,8 +36,8 @@ } return evt; } - CustomEvent.prototype = window.Event.prototype; - return CustomEvent; + customEvent.prototype = window.Event.prototype; + return customEvent; })();