Permalink
Browse files

Navigation: Try to get rid of call to .closest( ".ui-btn" ) by making…

… use of buttonElements data added during buttonMarkup()
  • Loading branch information...
gabrielschulhof committed Nov 27, 2012
1 parent b5ccb80 commit f52df7b138e34d1586a77ae902662c431b5284eb
Showing with 11 additions and 2 deletions.
  1. +11 −2 js/jquery.mobile.navigation.js
@@ -1330,7 +1330,7 @@ define( [
//add active state on vclick
$( document ).bind( "vclick", function( event ) {
var link, $link, $btn, $target = $( event.target );
var link, $link, $btn, btnEls, $target = $( event.target );
// if this isn't a left click we don't care. Its important to note
// that when the virtual event is generated it will create the which attr
if ( event.which > 1 || !$.mobile.linkBindingEnabled ) {
@@ -1340,6 +1340,8 @@ define( [
if ( $target.data( "mobile-button" ) ) {
if ( !getAjaxFormData( $target.closest( "form" ), true ) ) {
return;
} else {
$target = $target.parent();
}
} else {
link = findClosestLink( event.target );
@@ -1357,7 +1359,14 @@ define( [
$target = $link;
}
$btn = $target.closest( ".ui-btn" ).not( ".ui-disabled" );
btnEls = $.data( $target[ 0 ], "buttonElements" );
if ( btnEls ) {
$target = $( btnEls.outer );
} else {
$target = $target.closest( ".ui-btn" );
}
$btn = $target.not( ".ui-disabled" );
if ( !$btn.hasClass( $.mobile.activeBtnClass ) ) {
removeActiveLinkClass( true );
$activeClickedLink = $btn;

0 comments on commit f52df7b

Please sign in to comment.