Skip to content

Commit a10847a

Browse files
committed
Menu: Fix style issues
Closes jquerygh-1491
1 parent 4e6e27d commit a10847a

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

ui/menu.js

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
//>>css.structure: ../themes/base/menu.css
1717
//>>css.theme: ../themes/base/theme.css
1818

19-
(function( factory ) {
19+
( function( factory ) {
2020
if ( typeof define === "function" && define.amd ) {
2121

2222
// AMD. Register as an anonymous module.
23-
define([
23+
define( [
2424
"jquery",
2525
"./core",
2626
"./widget",
@@ -31,7 +31,7 @@
3131
// Browser globals
3232
factory( jQuery );
3333
}
34-
}(function( $ ) {
34+
}( function( $ ) {
3535

3636
return $.widget( "ui.menu", {
3737
version: "@VERSION",
@@ -64,18 +64,18 @@ return $.widget( "ui.menu", {
6464
this.mouseHandled = false;
6565
this.element
6666
.uniqueId()
67-
.attr({
67+
.attr( {
6868
role: this.options.role,
6969
tabIndex: 0
70-
});
70+
} );
7171

7272
if ( this.options.disabled ) {
7373
this._addClass( null, "ui-state-disabled" );
7474
this.element.attr( "aria-disabled", "true" );
7575
}
7676

7777
this._addClass( "ui-menu", "ui-widget ui-widget-content" );
78-
this._on({
78+
this._on( {
7979

8080
// Prevent focus from sticking to links inside menu after clicking
8181
// them (focus should always stay on UL during navigation).
@@ -134,14 +134,14 @@ return $.widget( "ui.menu", {
134134
}
135135
},
136136
blur: function( event ) {
137-
this._delay(function() {
138-
if ( !$.contains( this.element[0], $.ui.safeActiveElement( this.document[0] ) ) ) {
137+
this._delay( function() {
138+
if ( !$.contains( this.element[ 0 ], $.ui.safeActiveElement( this.document[ 0 ] ) ) ) {
139139
this.collapseAll( event );
140140
}
141-
});
141+
} );
142142
},
143143
keydown: "_keydown"
144-
});
144+
} );
145145

146146
this.refresh();
147147

@@ -155,7 +155,7 @@ return $.widget( "ui.menu", {
155155
// Reset the mouseHandled flag
156156
this.mouseHandled = false;
157157
}
158-
});
158+
} );
159159
},
160160

161161
_destroy: function() {
@@ -181,12 +181,12 @@ return $.widget( "ui.menu", {
181181
.removeUniqueId()
182182
.show();
183183

184-
submenus.children().each(function() {
184+
submenus.children().each( function() {
185185
var elem = $( this );
186186
if ( elem.data( "ui-menu-submenu-caret" ) ) {
187187
elem.remove();
188188
}
189-
});
189+
} );
190190
},
191191

192192
_keydown: function( event ) {
@@ -256,7 +256,7 @@ return $.widget( "ui.menu", {
256256
if ( match.length ) {
257257
this.focus( event, match );
258258
this.previousFilter = character;
259-
this.filterTimer = this._delay(function() {
259+
this.filterTimer = this._delay( function() {
260260
delete this.previousFilter;
261261
}, 1000 );
262262
} else {
@@ -290,12 +290,12 @@ return $.widget( "ui.menu", {
290290
// Initialize nested menus
291291
newSubmenus = submenus.filter( ":not(.ui-menu)" )
292292
.hide()
293-
.attr({
293+
.attr( {
294294
role: this.options.role,
295295
"aria-hidden": "true",
296296
"aria-expanded": "false"
297-
})
298-
.each(function() {
297+
} )
298+
.each( function() {
299299
var menu = $( this ),
300300
item = menu.prev(),
301301
submenuCaret = $( "<span>" ).data( "ui-menu-submenu-caret", true );
@@ -305,30 +305,30 @@ return $.widget( "ui.menu", {
305305
.attr( "aria-haspopup", "true" )
306306
.prepend( submenuCaret );
307307
menu.attr( "aria-labelledby", item.attr( "id" ) );
308-
});
308+
} );
309309

310310
this._addClass( newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front" );
311311

312312
menus = submenus.add( this.element );
313313
items = menus.find( this.options.items );
314314

315315
// Initialize menu-items containing spaces and/or dashes only as dividers
316-
items.not( ".ui-menu-item" ).each(function() {
316+
items.not( ".ui-menu-item" ).each( function() {
317317
var item = $( this );
318318
if ( that._isDivider( item ) ) {
319319
that._addClass( item, "ui-menu-divider", "ui-widget-content" );
320320
}
321-
});
321+
} );
322322

323323
// Don't refresh list items that are already adapted
324324
newItems = items.not( ".ui-menu-item, .ui-menu-divider" );
325325
newWrappers = newItems.children()
326326
.not( ".ui-menu" )
327327
.uniqueId()
328-
.attr({
328+
.attr( {
329329
tabIndex: -1,
330330
role: this._itemRole()
331-
});
331+
} );
332332
this._addClass( newItems, "ui-menu-item" )
333333
._addClass( newWrappers, "ui-menu-item-wrapper" );
334334

@@ -388,14 +388,14 @@ return $.widget( "ui.menu", {
388388
if ( event && event.type === "keydown" ) {
389389
this._close();
390390
} else {
391-
this.timer = this._delay(function() {
391+
this.timer = this._delay( function() {
392392
this._close();
393393
}, this.delay );
394394
}
395395

396396
nested = item.children( ".ui-menu" );
397397
if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) {
398-
this._startOpening(nested);
398+
this._startOpening( nested );
399399
}
400400
this.activeMenu = item.parent();
401401

@@ -405,8 +405,8 @@ return $.widget( "ui.menu", {
405405
_scrollIntoView: function( item ) {
406406
var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
407407
if ( this._hasScroll() ) {
408-
borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
409-
paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
408+
borderTop = parseFloat( $.css( this.activeMenu[ 0 ], "borderTopWidth" ) ) || 0;
409+
paddingTop = parseFloat( $.css( this.activeMenu[ 0 ], "paddingTop" ) ) || 0;
410410
offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
411411
scroll = this.activeMenu.scrollTop();
412412
elementHeight = this.activeMenu.height();
@@ -445,14 +445,14 @@ return $.widget( "ui.menu", {
445445
return;
446446
}
447447

448-
this.timer = this._delay(function() {
448+
this.timer = this._delay( function() {
449449
this._close();
450450
this._open( submenu );
451451
}, this.delay );
452452
},
453453

454454
_open: function( submenu ) {
455-
var position = $.extend({
455+
var position = $.extend( {
456456
of: this.active
457457
}, this.options.position );
458458

@@ -470,7 +470,7 @@ return $.widget( "ui.menu", {
470470

471471
collapseAll: function( event, all ) {
472472
clearTimeout( this.timer );
473-
this.timer = this._delay(function() {
473+
this.timer = this._delay( function() {
474474
// If we were passed an event, look for the submenu that contains the event
475475
var currentMenu = all ? this.element :
476476
$( event && event.target ).closest( this.element.find( ".ui-menu" ) );
@@ -527,16 +527,16 @@ return $.widget( "ui.menu", {
527527
var newItem = this.active &&
528528
this.active
529529
.children( ".ui-menu " )
530-
.find( this.options.items )
531-
.first();
530+
.find( this.options.items )
531+
.first();
532532

533533
if ( newItem && newItem.length ) {
534534
this._open( newItem.parent() );
535535

536536
// Delay so Firefox will not hide activedescendant change in expanding submenu from AT
537-
this._delay(function() {
537+
this._delay( function() {
538538
this.focus( event, newItem );
539-
});
539+
} );
540540
}
541541
},
542542

@@ -589,10 +589,10 @@ return $.widget( "ui.menu", {
589589
if ( this._hasScroll() ) {
590590
base = this.active.offset().top;
591591
height = this.element.height();
592-
this.active.nextAll( ".ui-menu-item" ).each(function() {
592+
this.active.nextAll( ".ui-menu-item" ).each( function() {
593593
item = $( this );
594594
return item.offset().top - base - height < 0;
595-
});
595+
} );
596596

597597
this.focus( event, item );
598598
} else {
@@ -613,10 +613,10 @@ return $.widget( "ui.menu", {
613613
if ( this._hasScroll() ) {
614614
base = this.active.offset().top;
615615
height = this.element.height();
616-
this.active.prevAll( ".ui-menu-item" ).each(function() {
616+
this.active.prevAll( ".ui-menu-item" ).each( function() {
617617
item = $( this );
618618
return item.offset().top - base + height > 0;
619-
});
619+
} );
620620

621621
this.focus( event, item );
622622
} else {
@@ -646,13 +646,13 @@ return $.widget( "ui.menu", {
646646
return this.activeMenu
647647
.find( this.options.items )
648648

649-
// Only match on items, not dividers or other content (#10571)
650-
.filter( ".ui-menu-item" )
651-
.filter(function() {
652-
return regex.test(
653-
$.trim( $( this ).children( ".ui-menu-item-wrapper" ).text() ) );
654-
});
649+
// Only match on items, not dividers or other content (#10571)
650+
.filter( ".ui-menu-item" )
651+
.filter( function() {
652+
return regex.test(
653+
$.trim( $( this ).children( ".ui-menu-item-wrapper" ).text() ) );
654+
} );
655655
}
656-
});
656+
} );
657657

658-
}));
658+
} ) );

0 commit comments

Comments
 (0)