Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Switch back to hijacking links on the click event. We'll focus on imp…

…roving "percieved" visual performance since launching a page load and transitions on vclick opens us up to too many problems:

	- Third party click handlers never called.
	- Touch and click target mismatches due markup changes before the click events are generated. (What looks like a double click event)
  • Loading branch information...
commit d43bbfc52afc9c03284293db1053cc6abc5f557f 1 parent 5c37bea
@jblas jblas authored
Showing with 4 additions and 28 deletions.
  1. +4 −28 js/jquery.mobile.navigation.js
View
32 js/jquery.mobile.navigation.js
@@ -687,11 +687,8 @@
});
- //temporary fix for allowing 3rd party onclick handlers to still function.
- var preventClickDefault = false, stopClickPropagation = false;
-
//click routing - direct to HTTP or Ajax, accordingly
- $( "a" ).live( "vclick", function(event) {
+ $( "a" ).live( "click", function(event) {
var $this = $(this),
@@ -732,27 +729,17 @@
//if data-ajax attr is set to false, use the default behavior of a link
hasAjaxDisabled = $this.is( ":jqmData(ajax='false')" );
- //reset our prevDefault value because I'm paranoid.
- preventClickDefault = stopClickPropagation = false;
-
//if there's a data-rel=back attr, go back in history
if( $this.is( ":jqmData(rel='back')" ) ){
window.history.back();
- preventClickDefault = stopClickPropagation = true;
- return;
+ return false;
}
//prevent # urls from bubbling
//path.get() is replaced to combat abs url prefixing in IE
if( url.replace(path.get(), "") == "#" ){
//for links created purely for interaction - ignore
- //don't call preventDefault on the event here, vclick
- //may have been triggered by a touchend, before any moues
- //click event was dispatched and we want to make sure
- //3rd party onclick handlers get triggered. If and when
- //a mouse click event is generated, our live("click") handler
- //will get triggered and do the preventDefault.
- preventClickDefault = true;
+ event.preventDefault();
return;
}
@@ -786,18 +773,7 @@
url = path.stripHash( url );
$.mobile.changePage( url, transition, reverse);
- preventClickDefault = true;
- });
-
- $( "a" ).live( "click", function(event) {
- if (preventClickDefault){
- event.preventDefault();
- preventClickDefault = false;
- }
- if (stopClickPropagation){
- event.stopPropagation();
- stopClickPropagation = false;
- }
+ event.preventDefault();
});
//hashchange event handler
Please sign in to comment.
Something went wrong with that request. Please try again.