@@ -38,23 +38,23 @@ $.widget("ui.selectmenu", {
38
38
var self = this , o = this . options ;
39
39
40
40
// set a default id value, generate a new random one if not set by developer
41
- var selectmenuId = this . element . attr ( 'id' ) . replace ( / ( : | \. ) / g , '\\$1 ' ) || 'ui-selectmenu-' + Math . random ( ) . toString ( 16 ) . slice ( 2 , 10 ) ;
41
+ var selectmenuId = this . element . attr ( 'id' ) . replace ( ':' , '\\: ' ) || 'ui-selectmenu-' + Math . random ( ) . toString ( 16 ) . slice ( 2 , 10 ) ;
42
42
43
43
// quick array of button and menu id's
44
- this . ids = [ selectmenuId + '-button' , selectmenuId + '-menu' ] ;
44
+ this . ids = [ selectmenuId , selectmenuId + '-button' , selectmenuId + '-menu' ] ;
45
45
46
46
// define safe mouseup for future toggling
47
47
this . _safemouseup = true ;
48
48
49
49
// create menu button wrapper
50
50
this . newelement = $ ( '<a />' , {
51
51
'class' : this . widgetBaseClass + ' ui-widget ui-state-default ui-corner-all' ,
52
- 'id' : this . ids [ 0 ] ,
52
+ 'id' : this . ids [ 1 ] ,
53
53
'role' : 'button' ,
54
54
'href' : '#nogo' ,
55
55
'tabindex' : this . element . attr ( 'disabled' ) ? 1 : 0 ,
56
56
'aria-haspopup' : true ,
57
- 'aria-owns' : this . ids [ 1 ]
57
+ 'aria-owns' : this . ids [ 2 ]
58
58
} ) ;
59
59
this . newelementWrap = $ ( o . wrapperElement )
60
60
. append ( this . newelement )
@@ -78,7 +78,7 @@ $.widget("ui.selectmenu", {
78
78
79
79
// make associated form label trigger focus
80
80
$ ( 'label[for="' + selectmenuId + '"]' )
81
- . attr ( 'for' , this . ids [ 0 ] )
81
+ . attr ( 'for' , this . ids [ 1 ] )
82
82
. bind ( 'click.selectmenu' , function ( ) {
83
83
self . newelement [ 0 ] . focus ( ) ;
84
84
return false ;
@@ -183,8 +183,8 @@ $.widget("ui.selectmenu", {
183
183
'class' : 'ui-widget ui-widget-content' ,
184
184
'aria-hidden' : true ,
185
185
'role' : 'listbox' ,
186
- 'aria-labelledby' : this . ids [ 0 ] ,
187
- 'id' : this . ids [ 1 ]
186
+ 'aria-labelledby' : this . ids [ 1 ] ,
187
+ 'id' : this . ids [ 2 ]
188
188
} ) ;
189
189
this . listWrap = $ ( o . wrapperElement )
190
190
. addClass ( self . widgetBaseClass + '-menu' )
@@ -447,8 +447,8 @@ $.widget("ui.selectmenu", {
447
447
$ ( document ) . unbind ( ".selectmenu" ) ;
448
448
449
449
// unbind click on label, reset its for attr
450
- $ ( 'label[for=' + this . newelement . attr ( 'id' ) + ']' )
451
- . attr ( 'for' , this . element . attr ( 'id' ) )
450
+ $ ( 'label[for=' + this . ids [ 0 ] + ']' )
451
+ . attr ( 'for' , this . ids [ 0 ] )
452
452
. unbind ( '.selectmenu' ) ;
453
453
454
454
this . newelementWrap . remove ( ) ;
0 commit comments