Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit d43bbfc

Browse files
committed
Switch back to hijacking links on the click event. We'll focus on improving "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)
1 parent 5c37bea commit d43bbfc

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

js/jquery.mobile.navigation.js

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -687,11 +687,8 @@
687687
});
688688

689689

690-
//temporary fix for allowing 3rd party onclick handlers to still function.
691-
var preventClickDefault = false, stopClickPropagation = false;
692-
693690
//click routing - direct to HTTP or Ajax, accordingly
694-
$( "a" ).live( "vclick", function(event) {
691+
$( "a" ).live( "click", function(event) {
695692

696693
var $this = $(this),
697694

@@ -732,27 +729,17 @@
732729
//if data-ajax attr is set to false, use the default behavior of a link
733730
hasAjaxDisabled = $this.is( ":jqmData(ajax='false')" );
734731

735-
//reset our prevDefault value because I'm paranoid.
736-
preventClickDefault = stopClickPropagation = false;
737-
738732
//if there's a data-rel=back attr, go back in history
739733
if( $this.is( ":jqmData(rel='back')" ) ){
740734
window.history.back();
741-
preventClickDefault = stopClickPropagation = true;
742-
return;
735+
return false;
743736
}
744737

745738
//prevent # urls from bubbling
746739
//path.get() is replaced to combat abs url prefixing in IE
747740
if( url.replace(path.get(), "") == "#" ){
748741
//for links created purely for interaction - ignore
749-
//don't call preventDefault on the event here, vclick
750-
//may have been triggered by a touchend, before any moues
751-
//click event was dispatched and we want to make sure
752-
//3rd party onclick handlers get triggered. If and when
753-
//a mouse click event is generated, our live("click") handler
754-
//will get triggered and do the preventDefault.
755-
preventClickDefault = true;
742+
event.preventDefault();
756743
return;
757744
}
758745

@@ -786,18 +773,7 @@
786773
url = path.stripHash( url );
787774

788775
$.mobile.changePage( url, transition, reverse);
789-
preventClickDefault = true;
790-
});
791-
792-
$( "a" ).live( "click", function(event) {
793-
if (preventClickDefault){
794-
event.preventDefault();
795-
preventClickDefault = false;
796-
}
797-
if (stopClickPropagation){
798-
event.stopPropagation();
799-
stopClickPropagation = false;
800-
}
776+
event.preventDefault();
801777
});
802778

803779
//hashchange event handler

0 commit comments

Comments
 (0)