mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-09 23:24:44 +00:00
If ajax is disabled, exit the click handler early and avoid parsing the href at all. Thanks for the idea, @toddparker! Fixes #1846.
This commit is contained in:
parent
b3aa56582c
commit
722ed2cbbf
1 changed files with 15 additions and 6 deletions
|
|
@ -960,7 +960,11 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var $link = $( link );
|
var $link = $( link ),
|
||||||
|
//remove active link class if external (then it won't be there if you come back)
|
||||||
|
httpCleanup = function(){
|
||||||
|
window.setTimeout( function() { removeActiveLinkClass( true ); }, 200 );
|
||||||
|
};
|
||||||
|
|
||||||
//if there's a data-rel=back attr, go back in history
|
//if there's a data-rel=back attr, go back in history
|
||||||
if( $link.is( ":jqmData(rel='back')" ) ) {
|
if( $link.is( ":jqmData(rel='back')" ) ) {
|
||||||
|
|
@ -968,6 +972,13 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if ajax is disabled, exit early
|
||||||
|
if( !$.mobile.ajaxEnabled ){
|
||||||
|
httpCleanup();
|
||||||
|
//use default click handling
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var baseUrl = getClosestBaseUrl( $link ),
|
var baseUrl = getClosestBaseUrl( $link ),
|
||||||
|
|
||||||
//get href, if defined, otherwise default to empty hash
|
//get href, if defined, otherwise default to empty hash
|
||||||
|
|
@ -1016,10 +1027,8 @@
|
||||||
|
|
||||||
$activeClickedLink = $link.closest( ".ui-btn" );
|
$activeClickedLink = $link.closest( ".ui-btn" );
|
||||||
|
|
||||||
if( isExternal || !$.mobile.ajaxEnabled ) {
|
if( isExternal ) {
|
||||||
//remove active link class if external (then it won't be there if you come back)
|
httpCleanup();
|
||||||
window.setTimeout( function() { removeActiveLinkClass( true ); }, 200 );
|
|
||||||
|
|
||||||
//use default click handling
|
//use default click handling
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue