From 94eb67cdcefa33e0abe693052a3dc4db7d0b0e78 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 3 Jun 2014 21:53:30 +0800 Subject: [PATCH 1/4] CustomEvent is already polyfilled by ie9.js --- src/utilities.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/utilities.js b/src/utilities.js index 76a011df8..dc7aa32ec 100644 --- a/src/utilities.js +++ b/src/utilities.js @@ -53,15 +53,10 @@ var $trigger = function(el,event) { el.dispatchEvent(e); }; var $triggerc = function(el,event) { - if (window.CustomEvent) { - var e = new CustomEvent(event,{ - bubbles: true, - cancelable: true - }); - } else { - var e = document.createEvent('CustomEvent'); - e.initCustomEvent(event, true, true); - } + var e = new CustomEvent(event,{ + bubbles: true, + cancelable: true + }); el.dispatchEvent(e); }; From 2d4325ad1fcd577251bca5c9855204395a473dcc Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 3 Jun 2014 21:56:53 +0800 Subject: [PATCH 2/4] Avoid redefinable undefined in polyfill --- src/ie9.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ie9.js b/src/ie9.js index 9343675ea..42de8aac2 100644 --- a/src/ie9.js +++ b/src/ie9.js @@ -1,8 +1,8 @@ // CustomEvent constructor polyfill // From MDN -(function () { +(function (undef) { function CustomEvent ( event, params ) { - params = params || { bubbles: false, cancelable: false, detail: undefined }; + params = params || { bubbles: false, cancelable: false, detail: undef }; var evt = document.createEvent( 'CustomEvent' ); evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); return evt; From fadab2f19da12e4be8f3baf9fb493f5cd0122415 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 3 Jun 2014 22:12:24 +0800 Subject: [PATCH 3/4] JSHint polyfill fixes --- src/ie9.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ie9.js b/src/ie9.js index 42de8aac2..01487ee96 100644 --- a/src/ie9.js +++ b/src/ie9.js @@ -6,7 +6,7 @@ var evt = document.createEvent( 'CustomEvent' ); evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); return evt; - }; + } CustomEvent.prototype = window.Event.prototype; @@ -20,8 +20,8 @@ var vendors = ['ms', 'moz', 'webkit', 'o']; for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; - window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] - || window[vendors[x]+'CancelRequestAnimationFrame']; + window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] || + window[vendors[x]+'CancelRequestAnimationFrame']; } if (!window.requestAnimationFrame) From f5d488ab7ce3031893cdff7461cc414e9f8c3600 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 3 Jun 2014 22:14:36 +0800 Subject: [PATCH 4/4] JSHint fix for utilities --- src/utilities.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utilities.js b/src/utilities.js index dc7aa32ec..ab48fc3e8 100644 --- a/src/utilities.js +++ b/src/utilities.js @@ -34,13 +34,14 @@ var $extend = function(destination) { var $each = function(obj,callback) { if(!obj) return; + var i; if(typeof obj.length !== 'undefined') { - for(var i=0; i