13
13
*/
14
14
( function ( $ ) {
15
15
16
- var idIncrement = 0 ,
17
- currentEventTarget = null ;
16
+ var currentEventTarget = null ;
18
17
19
18
$ . widget ( "ui.menu" , {
20
19
version : "@VERSION" ,
@@ -35,12 +34,11 @@ $.widget( "ui.menu", {
35
34
} ,
36
35
_create : function ( ) {
37
36
this . activeMenu = this . element ;
38
- this . menuId = this . element . attr ( "id" ) || "ui-menu-" + idIncrement ++ ;
39
37
this . element
38
+ . uniqueId ( )
40
39
. addClass ( "ui-menu ui-widget ui-widget-content ui-corner-all" )
41
40
. toggleClass ( "ui-menu-icons" , ! ! this . element . find ( ".ui-icon" ) . length )
42
41
. attr ( {
43
- id : this . menuId ,
44
42
role : this . options . role ,
45
43
tabIndex : 0
46
44
} )
@@ -145,18 +143,21 @@ $.widget( "ui.menu", {
145
143
. removeAttr ( "aria-labelledby" )
146
144
. removeAttr ( "aria-expanded" )
147
145
. removeAttr ( "aria-hidden" )
146
+ . removeAttr ( "aria-disabled" )
147
+ . removeUniqueId ( )
148
148
. show ( ) ;
149
149
150
150
// destroy menu items
151
151
this . element . find ( ".ui-menu-item" )
152
152
. removeClass ( "ui-menu-item" )
153
153
. removeAttr ( "role" )
154
+ . removeAttr ( "aria-disabled" )
154
155
. children ( "a" )
156
+ . removeUniqueId ( )
155
157
. removeClass ( "ui-corner-all ui-state-hover" )
156
158
. removeAttr ( "tabIndex" )
157
159
. removeAttr ( "role" )
158
160
. removeAttr ( "aria-haspopup" )
159
- . removeAttr ( "id" )
160
161
// TODO: is this correct? Don't these exist in the original markup?
161
162
. children ( ".ui-icon" )
162
163
. remove ( ) ;
@@ -273,7 +274,6 @@ $.widget( "ui.menu", {
273
274
refresh : function ( ) {
274
275
// initialize nested menus
275
276
var menus ,
276
- menuId = this . menuId ,
277
277
submenus = this . element . find ( this . options . menus + ":not(.ui-menu)" )
278
278
. addClass ( "ui-menu ui-widget ui-widget-content ui-corner-all" )
279
279
. hide ( )
@@ -290,13 +290,11 @@ $.widget( "ui.menu", {
290
290
. addClass ( "ui-menu-item" )
291
291
. attr ( "role" , "presentation" )
292
292
. children ( "a" )
293
+ . uniqueId ( )
293
294
. addClass ( "ui-corner-all" )
294
295
. attr ( {
295
296
tabIndex : - 1 ,
296
- role : this . _itemRole ( ) ,
297
- id : function ( i ) {
298
- return menuId + "-" + i ;
299
- }
297
+ role : this . _itemRole ( )
300
298
} ) ;
301
299
302
300
// initialize unlinked menu-items containing spaces and/or dashes only as dividers
0 commit comments