aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorAlexander Schmitz <arschmitz@gmail.com>2016-03-30 23:02:12 -0400
committerScott González <scott.gonzalez@gmail.com>2016-04-13 11:31:47 -0400
commit88f74e16567cd7b3dd70ad92e29968ea3413458e (patch)
treee6f35b05ece0c1c47f7db4229d70fd721208ce8b /ui
parent55b53b54625d690bb1371cd7171b318e9e651dcb (diff)
downloadjquery-ui-88f74e16567cd7b3dd70ad92e29968ea3413458e.tar.gz
jquery-ui-88f74e16567cd7b3dd70ad92e29968ea3413458e.zip
Menu: Fix line length issues
Ref gh-1690
Diffstat (limited to 'ui')
-rw-r--r--ui/widgets/menu.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/ui/widgets/menu.js b/ui/widgets/menu.js
index 22db41988..329bfc610 100644
--- a/ui/widgets/menu.js
+++ b/ui/widgets/menu.js
@@ -81,6 +81,7 @@ return $.widget( "ui.menu", {
},
"click .ui-menu-item": function( event ) {
var target = $( event.target );
+ var active = $( $.ui.safeActiveElement( this.document[ 0 ] ) );
if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) {
this.select( event );
@@ -89,10 +90,13 @@ return $.widget( "ui.menu", {
this.mouseHandled = true;
}
+
+
// Open submenu on click
if ( target.has( ".ui-menu" ).length ) {
this.expand( event );
- } else if ( !this.element.is( ":focus" ) && $( $.ui.safeActiveElement( this.document[ 0 ] ) ).closest( ".ui-menu" ).length ) {
+ } else if ( !this.element.is( ":focus" ) &&
+ active.closest( ".ui-menu" ).length ) {
// Redirect focus to the menu
this.element.trigger( "focus", [ true ] );
@@ -142,7 +146,11 @@ return $.widget( "ui.menu", {
},
blur: function( event ) {
this._delay( function() {
- if ( !$.contains( this.element[ 0 ], $.ui.safeActiveElement( this.document[ 0 ] ) ) ) {
+ var notContained = !$.contains(
+ this.element[ 0 ],
+ $.ui.safeActiveElement( this.document[ 0 ] )
+ );
+ if ( notContained ) {
this.collapseAll( event );
}
} );
@@ -479,7 +487,8 @@ return $.widget( "ui.menu", {
var currentMenu = all ? this.element :
$( event && event.target ).closest( this.element.find( ".ui-menu" ) );
- // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
+ // If we found no valid submenu ancestor, use the main menu to close all
+ // sub menus anyway
if ( !currentMenu.length ) {
currentMenu = this.element;
}