1616//>>css.structure: ../themes/base/menu.css
1717//>>css.theme: ../themes/base/theme.css
1818
19- ( function ( factory ) {
19+ ( function ( factory ) {
2020if ( typeof define === "function" && define . amd ) {
2121
2222// AMD. Register as an anonymous module.
23- define ( [
23+ define ( [
2424"jquery" ,
2525"./core" ,
2626"./widget" ,
3131// Browser globals
3232factory ( jQuery ) ;
3333}
34- } ( function ( $ ) {
34+ } ( function ( $ ) {
3535
3636return $ . widget ( "ui.menu" , {
3737version : "@VERSION" ,
@@ -64,18 +64,18 @@ return $.widget( "ui.menu", {
6464this . mouseHandled = false ;
6565this . element
6666. uniqueId ( )
67- . attr ( {
67+ . attr ( {
6868role : this . options . role ,
6969tabIndex : 0
70- } ) ;
70+ } ) ;
7171
7272if ( this . options . disabled ) {
7373this . _addClass ( null , "ui-state-disabled" ) ;
7474this . element . attr ( "aria-disabled" , "true" ) ;
7575}
7676
7777this . _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} ,
136136blur : 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 ] ) ) ) {
139139this . collapseAll ( event ) ;
140140}
141- } ) ;
141+ } ) ;
142142} ,
143143keydown : "_keydown"
144- } ) ;
144+ } ) ;
145145
146146this . refresh ( ) ;
147147
@@ -155,7 +155,7 @@ return $.widget( "ui.menu", {
155155// Reset the mouseHandled flag
156156this . 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 ( ) {
185185var elem = $ ( this ) ;
186186if ( elem . data ( "ui-menu-submenu-caret" ) ) {
187187elem . remove ( ) ;
188188}
189- } ) ;
189+ } ) ;
190190} ,
191191
192192_keydown : function ( event ) {
@@ -256,7 +256,7 @@ return $.widget( "ui.menu", {
256256if ( match . length ) {
257257this . focus ( event , match ) ;
258258this . previousFilter = character ;
259- this . filterTimer = this . _delay ( function ( ) {
259+ this . filterTimer = this . _delay ( function ( ) {
260260delete this . previousFilter ;
261261} , 1000 ) ;
262262} else {
@@ -290,12 +290,12 @@ return $.widget( "ui.menu", {
290290// Initialize nested menus
291291newSubmenus = submenus . filter ( ":not(.ui-menu)" )
292292. hide ( )
293- . attr ( {
293+ . attr ( {
294294role : this . options . role ,
295295"aria-hidden" : "true" ,
296296"aria-expanded" : "false"
297- } )
298- . each ( function ( ) {
297+ } )
298+ . each ( function ( ) {
299299var menu = $ ( this ) ,
300300item = menu . prev ( ) ,
301301submenuCaret = $ ( "<span>" ) . data ( "ui-menu-submenu-caret" , true ) ;
@@ -305,30 +305,30 @@ return $.widget( "ui.menu", {
305305. attr ( "aria-haspopup" , "true" )
306306. prepend ( submenuCaret ) ;
307307menu . attr ( "aria-labelledby" , item . attr ( "id" ) ) ;
308- } ) ;
308+ } ) ;
309309
310310this . _addClass ( newSubmenus , "ui-menu" , "ui-widget ui-widget-content ui-front" ) ;
311311
312312menus = submenus . add ( this . element ) ;
313313items = 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 ( ) {
317317var item = $ ( this ) ;
318318if ( that . _isDivider ( item ) ) {
319319that . _addClass ( item , "ui-menu-divider" , "ui-widget-content" ) ;
320320}
321- } ) ;
321+ } ) ;
322322
323323// Don't refresh list items that are already adapted
324324newItems = items . not ( ".ui-menu-item, .ui-menu-divider" ) ;
325325newWrappers = newItems . children ( )
326326. not ( ".ui-menu" )
327327. uniqueId ( )
328- . attr ( {
328+ . attr ( {
329329tabIndex : - 1 ,
330330role : this . _itemRole ( )
331- } ) ;
331+ } ) ;
332332this . _addClass ( newItems , "ui-menu-item" )
333333. _addClass ( newWrappers , "ui-menu-item-wrapper" ) ;
334334
@@ -388,14 +388,14 @@ return $.widget( "ui.menu", {
388388if ( event && event . type === "keydown" ) {
389389this . _close ( ) ;
390390} else {
391- this . timer = this . _delay ( function ( ) {
391+ this . timer = this . _delay ( function ( ) {
392392this . _close ( ) ;
393393} , this . delay ) ;
394394}
395395
396396nested = item . children ( ".ui-menu" ) ;
397397if ( nested . length && event && ( / ^ m o u s e / . test ( event . type ) ) ) {
398- this . _startOpening ( nested ) ;
398+ this . _startOpening ( nested ) ;
399399}
400400this . activeMenu = item . parent ( ) ;
401401
@@ -405,8 +405,8 @@ return $.widget( "ui.menu", {
405405_scrollIntoView : function ( item ) {
406406var borderTop , paddingTop , offset , scroll , elementHeight , itemHeight ;
407407if ( 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 ;
410410offset = item . offset ( ) . top - this . activeMenu . offset ( ) . top - borderTop - paddingTop ;
411411scroll = this . activeMenu . scrollTop ( ) ;
412412elementHeight = this . activeMenu . height ( ) ;
@@ -445,14 +445,14 @@ return $.widget( "ui.menu", {
445445return ;
446446}
447447
448- this . timer = this . _delay ( function ( ) {
448+ this . timer = this . _delay ( function ( ) {
449449this . _close ( ) ;
450450this . _open ( submenu ) ;
451451} , this . delay ) ;
452452} ,
453453
454454_open : function ( submenu ) {
455- var position = $ . extend ( {
455+ var position = $ . extend ( {
456456of : this . active
457457} , this . options . position ) ;
458458
@@ -470,7 +470,7 @@ return $.widget( "ui.menu", {
470470
471471collapseAll : function ( event , all ) {
472472clearTimeout ( 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
475475var currentMenu = all ? this . element :
476476$ ( event && event . target ) . closest ( this . element . find ( ".ui-menu" ) ) ;
@@ -527,16 +527,16 @@ return $.widget( "ui.menu", {
527527var newItem = this . active &&
528528this . active
529529. children ( ".ui-menu " )
530- . find ( this . options . items )
531- . first ( ) ;
530+ . find ( this . options . items )
531+ . first ( ) ;
532532
533533if ( newItem && newItem . length ) {
534534this . _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 ( ) {
538538this . focus ( event , newItem ) ;
539- } ) ;
539+ } ) ;
540540}
541541} ,
542542
@@ -589,10 +589,10 @@ return $.widget( "ui.menu", {
589589if ( this . _hasScroll ( ) ) {
590590base = this . active . offset ( ) . top ;
591591height = this . element . height ( ) ;
592- this . active . nextAll ( ".ui-menu-item" ) . each ( function ( ) {
592+ this . active . nextAll ( ".ui-menu-item" ) . each ( function ( ) {
593593item = $ ( this ) ;
594594return item . offset ( ) . top - base - height < 0 ;
595- } ) ;
595+ } ) ;
596596
597597this . focus ( event , item ) ;
598598} else {
@@ -613,10 +613,10 @@ return $.widget( "ui.menu", {
613613if ( this . _hasScroll ( ) ) {
614614base = this . active . offset ( ) . top ;
615615height = this . element . height ( ) ;
616- this . active . prevAll ( ".ui-menu-item" ) . each ( function ( ) {
616+ this . active . prevAll ( ".ui-menu-item" ) . each ( function ( ) {
617617item = $ ( this ) ;
618618return item . offset ( ) . top - base + height > 0 ;
619- } ) ;
619+ } ) ;
620620
621621this . focus ( event , item ) ;
622622} else {
@@ -646,13 +646,13 @@ return $.widget( "ui.menu", {
646646return 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