From e39f224fb91542b05b73e193136113cceef91aef Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Thu, 26 Sep 2013 13:00:09 -0500 Subject: [PATCH] tap polyfill only when from touch event --- dist/ionic-simple.js | 8 ++++---- dist/ionic.js | 13 +++---------- ext/simple/events.js | 8 ++++---- js/gestures.js | 13 +++---------- 4 files changed, 14 insertions(+), 28 deletions(-) diff --git a/dist/ionic-simple.js b/dist/ionic-simple.js index ba20d67fed..6e9a915b65 100644 --- a/dist/ionic-simple.js +++ b/dist/ionic-simple.js @@ -15,11 +15,11 @@ } function tapPolyfill(e) { - // evaluate the actual source event, not the created event by gestures.js - if(!e.gesture) return; + // if the source event wasn't from a touch event then don't use this polyfill + if(!e.gesture || e.gesture.pointerType !== "touch") return; var - e = e.gesture.srcEvent, + e = e.gesture.srcEvent, // evaluate the actual source event, not the created event by gestures.js ele = e.target; if(!e) return; @@ -53,6 +53,6 @@ } // global tap event listener polyfill for HTML elements that were "tapped" by the user - //ionic.on("tap", tapPolyfill, window); + ionic.on("tap", tapPolyfill, window); })(this, document, ionic); diff --git a/dist/ionic.js b/dist/ionic.js index b5c841d631..0dda6d3954 100644 --- a/dist/ionic.js +++ b/dist/ionic.js @@ -293,16 +293,9 @@ if ( document.readyState === "complete" ) { ionic.Gestures.event.determineEventTypes(); // Register all gestures inside ionic.Gestures.gestures - if(this === this.window) { - // this is a window, only add these - ionic.Gestures.detection.register(ionic.Gestures.gestures.Tap); - - } else { - // everything else but the window - for(var name in ionic.Gestures.gestures) { - if(ionic.Gestures.gestures.hasOwnProperty(name)) { - ionic.Gestures.detection.register(ionic.Gestures.gestures[name]); - } + for(var name in ionic.Gestures.gestures) { + if(ionic.Gestures.gestures.hasOwnProperty(name)) { + ionic.Gestures.detection.register(ionic.Gestures.gestures[name]); } } diff --git a/ext/simple/events.js b/ext/simple/events.js index ba20d67fed..6e9a915b65 100644 --- a/ext/simple/events.js +++ b/ext/simple/events.js @@ -15,11 +15,11 @@ } function tapPolyfill(e) { - // evaluate the actual source event, not the created event by gestures.js - if(!e.gesture) return; + // if the source event wasn't from a touch event then don't use this polyfill + if(!e.gesture || e.gesture.pointerType !== "touch") return; var - e = e.gesture.srcEvent, + e = e.gesture.srcEvent, // evaluate the actual source event, not the created event by gestures.js ele = e.target; if(!e) return; @@ -53,6 +53,6 @@ } // global tap event listener polyfill for HTML elements that were "tapped" by the user - //ionic.on("tap", tapPolyfill, window); + ionic.on("tap", tapPolyfill, window); })(this, document, ionic); diff --git a/js/gestures.js b/js/gestures.js index 53efe0f313..7dbb356e2e 100644 --- a/js/gestures.js +++ b/js/gestures.js @@ -90,16 +90,9 @@ ionic.Gestures.event.determineEventTypes(); // Register all gestures inside ionic.Gestures.gestures - if(this === this.window) { - // this is a window, only add these - ionic.Gestures.detection.register(ionic.Gestures.gestures.Tap); - - } else { - // everything else but the window - for(var name in ionic.Gestures.gestures) { - if(ionic.Gestures.gestures.hasOwnProperty(name)) { - ionic.Gestures.detection.register(ionic.Gestures.gestures[name]); - } + for(var name in ionic.Gestures.gestures) { + if(ionic.Gestures.gestures.hasOwnProperty(name)) { + ionic.Gestures.detection.register(ionic.Gestures.gestures[name]); } }