Permalink
Browse files

Revert "capture and retrigger clicks on the parent list item element …

…in navbars Fixes #4663"

This reverts commit dea9d31.
  • Loading branch information...
johnbender committed Aug 30, 2012
1 parent b9512bd commit aedd7428fe882ae898fd1e63ce79ef65c9a376a2
Showing with 4 additions and 35 deletions.
  1. +4 −24 js/jquery.mobile.navbar.js
  2. +0 −11 tests/unit/navbar/navbar_core.js
View
@@ -37,30 +37,10 @@ $.widget( "mobile.navbar", $.mobile.widget, {
iconpos: iconpos
});
$navbar.delegate( "li", "vclick", function( event ) {
// if the vclick was triggered on an anchor or the child
// of an anchor (eg, ui-btn), grab the parent link
var $link = $(event.target).closest( "a" );
// if there isn't a parent link find the child link and trigger a click
// this addresses Issue #4663 where the events are being triggered
// on the parent element in fixed position navbars
if( !$link.length ){
$link = $( this ).children( "a" ).first();
setTimeout(function() {
$link.trigger( "click" );
});
return false;
}
// clear existing active button states
$navbtns.removeClass( $.mobile.activeBtnClass );
// if the target button isn't disabled
if ( !$link.hasClass( "ui-disabled" ) ) {
$link.addClass( $.mobile.activeBtnClass );
$navbar.delegate( "a", "vclick", function( event ) {
if( !$(event.target).hasClass("ui-disabled") ) {
$navbtns.removeClass( $.mobile.activeBtnClass );
$( this ).addClass( $.mobile.activeBtnClass );
}
});
@@ -28,15 +28,4 @@
$.mobile.ignoreContentEnabled = false;
});
// Issue #4663
asyncTest( "clicks/taps triggered on anything above the link get retriggered on the link", function() {
expect( 1 );
$( document ).delegate( "li", "vclick", function( event ) {
ok($( event.target ).is("a"), "target should always be an anchor" );
start();
});
$.mobile.activePage.find( "div:jqmData(role=navbar) li" ).first().trigger( "click" );
});
})(jQuery);

0 comments on commit aedd742

Please sign in to comment.