Skip to content

Commit 88f74e1

Browse files
arschmitzscottgonzalez
authored andcommitted
Menu: Fix line length issues
Ref jquerygh-1690
1 parent 55b53b5 commit 88f74e1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

ui/widgets/menu.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ return $.widget( "ui.menu", {
8181
},
8282
"click .ui-menu-item": function( event ) {
8383
var target = $( event.target );
84+
var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
8485
if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
8586
this.select( event );
8687

@@ -89,10 +90,13 @@ return $.widget( "ui.menu", {
8990
this.mouseHandled = true;
9091
}
9192

93+
94+
9295
// Open submenu on click
9396
if ( target.has( ".ui-menu" ).length ) {
9497
this.expand( event );
95-
} else if ( !this.element.is( ":focus" ) && $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( ".ui-menu" ).length ) {
98+
} else if ( !this.element.is( ":focus" ) &&
99+
active.closest( ".ui-menu" ).length ) {
96100

97101
// Redirect focus to the menu
98102
this.element.trigger( "focus", [ true ] );
@@ -142,7 +146,11 @@ return $.widget( "ui.menu", {
142146
},
143147
blur: function( event ) {
144148
this._delay( function() {
145-
if ( !$.contains( this.element[ 0 ], $.ui.safeActiveElement( this.document[ 0 ] ) ) ) {
149+
var notContained = !$.contains(
150+
this.element[ 0 ],
151+
$.ui.safeActiveElement( this.document[ 0 ] )
152+
);
153+
if ( notContained ) {
146154
this.collapseAll( event );
147155
}
148156
} );
@@ -479,7 +487,8 @@ return $.widget( "ui.menu", {
479487
var currentMenu = all ? this.element :
480488
$( event && event.target ).closest( this.element.find( ".ui-menu" ) );
481489

482-
// If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
490+
// If we found no valid submenu ancestor, use the main menu to close all
491+
// sub menus anyway
483492
if ( !currentMenu.length ) {
484493
currentMenu = this.element;
485494
}

0 commit comments

Comments
 (0)