Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[navigation] vclick handler: Do not add active class if already added

This helps avoid setting an element which has the active class added by hand as $activeClickedLink, which will cause that element to lose its active class if another link is activated.
  • Loading branch information...
commit 35eea35a42aba78146786d67fef6f5fc7985d701 1 parent 6404d38
@gabrielschulhof gabrielschulhof authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 js/jquery.mobile.navigation.js
View
7 js/jquery.mobile.navigation.js
@@ -1325,7 +1325,7 @@ define( [
return;
}
- var link = findClosestLink( event.target );
+ var link = findClosestLink( event.target ), $btn;
// split from the previous return logic to avoid find closest where possible
// TODO teach $.mobile.hijackable to operate on raw dom elements so the link wrapping
@@ -1335,9 +1335,10 @@ define( [
}
if ( link ) {
- if ( path.parseUrl( link.getAttribute( "href" ) || "#" ).hash !== "#" ) {
+ $btn = $( link ).closest( ".ui-btn" ).not( ".ui-disabled" );
+ if ( path.parseUrl( link.getAttribute( "href" ) || "#" ).hash !== "#" && !$btn.hasClass( $.mobile.activeBtnClass ) ) {
removeActiveLinkClass( true );
- $activeClickedLink = $( link ).closest( ".ui-btn" ).not( ".ui-disabled" );
+ $activeClickedLink = $btn;
$activeClickedLink.addClass( $.mobile.activeBtnClass );
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.