@@ -55,7 +55,7 @@ $.widget( "ui.selectmenu", {
55
55
56
56
this . _drawMenu ( ) ;
57
57
58
- if ( this . element . attr ( ' disabled' ) ) {
58
+ if ( this . options . disabled ) {
59
59
this . disable ( ) ;
60
60
}
61
61
} ,
@@ -69,7 +69,7 @@ $.widget( "ui.selectmenu", {
69
69
// create button
70
70
this . button = $ ( '<a />' , {
71
71
href : '#' + this . ids . id ,
72
- tabindex : ( tabindex ? tabindex : this . element . attr ( ' disabled' ) ? - 1 : 0 ) ,
72
+ tabindex : ( tabindex ? tabindex : this . options . disabled ? - 1 : 0 ) ,
73
73
id : this . ids . button ,
74
74
css : {
75
75
width : this . element . outerWidth ( )
@@ -174,8 +174,9 @@ $.widget( "ui.selectmenu", {
174
174
this . menu . find ( "li" ) . not ( '.ui-selectmenu-optgroup' ) . find ( 'a' ) . attr ( 'role' , 'option' ) ;
175
175
this . menu . attr ( "aria-activedescendant" , this . menu . find ( "li.ui-menu-item a" ) . eq ( this . element [ 0 ] . selectedIndex ) . attr ( "id" ) ) ;
176
176
177
- // transfer disabled state
178
- if ( this . element . attr ( 'disabled' ) ) {
177
+ // set and transfer disabled state
178
+ this . _getCreateOptions ( ) ;
179
+ if ( this . options . disabled ) {
179
180
this . disable ( ) ;
180
181
} else {
181
182
this . enable ( )
@@ -395,6 +396,14 @@ $.widget( "ui.selectmenu", {
395
396
this . button . toggleClass ( 'ui-corner-top' , ! this . isOpen ) . toggleClass ( 'ui-corner-all' , this . isOpen ) ;
396
397
}
397
398
} ,
399
+
400
+ _getCreateOptions : function ( ) {
401
+ if ( this . element . attr ( 'disabled' ) ) {
402
+ this . options . disabled = true ;
403
+ } else {
404
+ this . options . disabled = false ;
405
+ }
406
+ } ,
398
407
399
408
_readOptions : function ( ) {
400
409
var data = [ ] ;
0 commit comments