mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
tap polyfill only when from touch event
This commit is contained in:
8
dist/ionic-simple.js
vendored
8
dist/ionic-simple.js
vendored
@ -15,11 +15,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function tapPolyfill(e) {
|
function tapPolyfill(e) {
|
||||||
// evaluate the actual source event, not the created event by gestures.js
|
// if the source event wasn't from a touch event then don't use this polyfill
|
||||||
if(!e.gesture) return;
|
if(!e.gesture || e.gesture.pointerType !== "touch") return;
|
||||||
|
|
||||||
var
|
var
|
||||||
e = e.gesture.srcEvent,
|
e = e.gesture.srcEvent, // evaluate the actual source event, not the created event by gestures.js
|
||||||
ele = e.target;
|
ele = e.target;
|
||||||
|
|
||||||
if(!e) return;
|
if(!e) return;
|
||||||
@ -53,6 +53,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// global tap event listener polyfill for HTML elements that were "tapped" by the user
|
// 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);
|
})(this, document, ionic);
|
||||||
|
|||||||
13
dist/ionic.js
vendored
13
dist/ionic.js
vendored
@ -293,16 +293,9 @@ if ( document.readyState === "complete" ) {
|
|||||||
ionic.Gestures.event.determineEventTypes();
|
ionic.Gestures.event.determineEventTypes();
|
||||||
|
|
||||||
// Register all gestures inside ionic.Gestures.gestures
|
// Register all gestures inside ionic.Gestures.gestures
|
||||||
if(this === this.window) {
|
for(var name in ionic.Gestures.gestures) {
|
||||||
// this is a window, only add these
|
if(ionic.Gestures.gestures.hasOwnProperty(name)) {
|
||||||
ionic.Gestures.detection.register(ionic.Gestures.gestures.Tap);
|
ionic.Gestures.detection.register(ionic.Gestures.gestures[name]);
|
||||||
|
|
||||||
} 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]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -15,11 +15,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function tapPolyfill(e) {
|
function tapPolyfill(e) {
|
||||||
// evaluate the actual source event, not the created event by gestures.js
|
// if the source event wasn't from a touch event then don't use this polyfill
|
||||||
if(!e.gesture) return;
|
if(!e.gesture || e.gesture.pointerType !== "touch") return;
|
||||||
|
|
||||||
var
|
var
|
||||||
e = e.gesture.srcEvent,
|
e = e.gesture.srcEvent, // evaluate the actual source event, not the created event by gestures.js
|
||||||
ele = e.target;
|
ele = e.target;
|
||||||
|
|
||||||
if(!e) return;
|
if(!e) return;
|
||||||
@ -53,6 +53,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// global tap event listener polyfill for HTML elements that were "tapped" by the user
|
// 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);
|
})(this, document, ionic);
|
||||||
|
|||||||
@ -90,16 +90,9 @@
|
|||||||
ionic.Gestures.event.determineEventTypes();
|
ionic.Gestures.event.determineEventTypes();
|
||||||
|
|
||||||
// Register all gestures inside ionic.Gestures.gestures
|
// Register all gestures inside ionic.Gestures.gestures
|
||||||
if(this === this.window) {
|
for(var name in ionic.Gestures.gestures) {
|
||||||
// this is a window, only add these
|
if(ionic.Gestures.gestures.hasOwnProperty(name)) {
|
||||||
ionic.Gestures.detection.register(ionic.Gestures.gestures.Tap);
|
ionic.Gestures.detection.register(ionic.Gestures.gestures[name]);
|
||||||
|
|
||||||
} 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]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user