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

Commit aedd742

Browse files
committed
Revert "capture and retrigger clicks on the parent list item element in navbars Fixes #4663"
This reverts commit dea9d31.
1 parent b9512bd commit aedd742

File tree

2 files changed

+4
-35
lines changed

2 files changed

+4
-35
lines changed

js/jquery.mobile.navbar.js

+4-24
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,10 @@ $.widget( "mobile.navbar", $.mobile.widget, {
3737
iconpos: iconpos
3838
});
3939

40-
$navbar.delegate( "li", "vclick", function( event ) {
41-
42-
// if the vclick was triggered on an anchor or the child
43-
// of an anchor (eg, ui-btn), grab the parent link
44-
var $link = $(event.target).closest( "a" );
45-
46-
// if there isn't a parent link find the child link and trigger a click
47-
// this addresses Issue #4663 where the events are being triggered
48-
// on the parent element in fixed position navbars
49-
if( !$link.length ){
50-
$link = $( this ).children( "a" ).first();
51-
setTimeout(function() {
52-
$link.trigger( "click" );
53-
});
54-
55-
return false;
56-
}
57-
58-
// clear existing active button states
59-
$navbtns.removeClass( $.mobile.activeBtnClass );
60-
61-
// if the target button isn't disabled
62-
if ( !$link.hasClass( "ui-disabled" ) ) {
63-
$link.addClass( $.mobile.activeBtnClass );
40+
$navbar.delegate( "a", "vclick", function( event ) {
41+
if( !$(event.target).hasClass("ui-disabled") ) {
42+
$navbtns.removeClass( $.mobile.activeBtnClass );
43+
$( this ).addClass( $.mobile.activeBtnClass );
6444
}
6545
});
6646

tests/unit/navbar/navbar_core.js

-11
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,4 @@
2828

2929
$.mobile.ignoreContentEnabled = false;
3030
});
31-
32-
// Issue #4663
33-
asyncTest( "clicks/taps triggered on anything above the link get retriggered on the link", function() {
34-
expect( 1 );
35-
$( document ).delegate( "li", "vclick", function( event ) {
36-
ok($( event.target ).is("a"), "target should always be an anchor" );
37-
start();
38-
});
39-
40-
$.mobile.activePage.find( "div:jqmData(role=navbar) li" ).first().trigger( "click" );
41-
});
4231
})(jQuery);

0 commit comments

Comments
 (0)