diff --git a/js/ext/angular/src/directive/ionicTouch.js b/js/ext/angular/src/directive/ionicTouch.js index b36fa5ea0f..a7699799c5 100644 --- a/js/ext/angular/src/directive/ionicTouch.js +++ b/js/ext/angular/src/directive/ionicTouch.js @@ -31,14 +31,14 @@ angular.module('ionic.ui.touch', []) }); }); - element[0].addEventListener('touchend', onTap, false); + ionic.on("release", onTap, element[0]); // Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click // something else nearby. element.onclick = function(event) { }; scope.$on('$destroy', function () { - element[0].removeEventListener('touchend', onTap); + ionic.off("release", onTap, element[0]); }); }; }]) diff --git a/js/ext/angular/test/list.html b/js/ext/angular/test/list.html index dee7f0c980..3e7e53d6ba 100644 --- a/js/ext/angular/test/list.html +++ b/js/ext/angular/test/list.html @@ -5,6 +5,16 @@ +
CLICK!
diff --git a/js/utils/tap.js b/js/utils/tap.js index e9797aadb3..09e4958198 100644 --- a/js/utils/tap.js +++ b/js/utils/tap.js @@ -184,11 +184,6 @@ }, REMOVE_PREVENT_DELAY); } - function touchEnd(e) { - tapPolyfill(e); - removeClickPrevent(e); - } - function stopEvent(e){ e.stopPropagation(); e.preventDefault(); @@ -223,13 +218,14 @@ REMOVE_PREVENT_DELAY = 800; } - // global action event listener for HTML elements that were tapped or held by the user - document.addEventListener('touchend', touchEnd, false); - // set global click handler and check if the event should stop or not document.addEventListener('click', preventGhostClick, true); - // listener used to remove ghostclick prevention + // global release event listener polyfill for HTML elements that were tapped or held + ionic.on("release", tapPolyfill, document); + + // listeners used to remove ghostclick prevention + document.addEventListener('touchend', removeClickPrevent, false); document.addEventListener('mouseup', removeClickPrevent, false); // in the case the user touched the screen, then scrolled, it shouldn't fire the click