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...
jblas committed Apr 4, 2011
1 parent 5c37bea commit d43bbfc52afc9c03284293db1053cc6abc5f557f
Showing with 4 additions and 28 deletions.
  1. +4 −28 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 = $ ":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( $ ":jqmData(rel='back')" ) ){
preventClickDefault = stopClickPropagation = true;
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;
@@ -786,18 +773,7 @@
url = path.stripHash( url );
$.mobile.changePage( url, transition, reverse);
preventClickDefault = true;
$( "a" ).live( "click", function(event) {
if (preventClickDefault){
preventClickDefault = false;
if (stopClickPropagation){
stopClickPropagation = false;
//hashchange event handler

0 comments on commit d43bbfc

Please sign in to comment.