Skip to content
Permalink
Browse files

Menu: Remove click binding that was supposed to prevent default on an…

…chor clicks on a disabled menu. Not relevant anymore since we removed the anchors. Partial fix for #8802 - Dev: Track down uses of .bind() inside widgets
  • Loading branch information...
jzaefferer committed Dec 3, 2013
1 parent 5494bc9 commit fe7c3003741cd5221e076235263df2b3d2fa9202
Showing with 3 additions and 30 deletions.
  1. +0 −21 tests/unit/menu/menu_events.js
  2. +3 −9 ui/jquery.ui.menu.js
@@ -629,27 +629,6 @@ asyncTest( "handle keyboard navigation with spelling of menu items", function()
element[ 0 ].focus();
});

test( "ensure default is prevented when clicking on anchors in disabled menus ", function() {
expect( 1 );
var element = $( "#menu1" ).menu();
element.bind( "click.menu", function(event) {
if ( !event.isDefaultPrevented() ) {
log();
}
});
log( "click", true );
click( element, "1" );
log( "afterclick,disable" );
element.menu( "option", "disabled", true );
click( element, "2" );
click( element, "3" );
click( element, "1" );
log( "enable" );
element.menu( "option", "disabled", false );
click( element, "3" );
equal( logOutput(), "click,1,afterclick,disable,enable,3", "Click order not valid." );
});

test( "#9469: Stopping propagation in a select event should not suppress subsequent select events.", function() {
expect( 1 );
var element = $( "#menu1" ).menu({
@@ -39,7 +39,8 @@ $.widget( "ui.menu", {

_create: function() {
this.activeMenu = this.element;
// flag used to prevent firing of the click handler

// Flag used to prevent firing of the click handler
// as the event bubbles up through nested menus
this.mouseHandled = false;
this.element
@@ -49,14 +50,7 @@ $.widget( "ui.menu", {
.attr({
role: this.options.role,
tabIndex: 0
})
// need to catch all clicks on disabled menu
// not possible through _on
.bind( "click" + this.eventNamespace, $.proxy(function( event ) {
if ( this.options.disabled ) {
event.preventDefault();
}
}, this ));
});

if ( this.options.disabled ) {
this.element

0 comments on commit fe7c300

Please sign in to comment.
You can’t perform that action at this time.