Skip to content

Commit c5d9dbc

Browse files
committed
Selectmenu: make use of _getCreateOptions
1 parent 04d9900 commit c5d9dbc

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

ui/jquery.ui.selectmenu.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ $.widget( "ui.selectmenu", {
5555

5656
this._drawMenu();
5757

58-
if ( this.element.attr( 'disabled' ) ) {
58+
if ( this.options.disabled ) {
5959
this.disable();
6060
}
6161
},
@@ -69,7 +69,7 @@ $.widget( "ui.selectmenu", {
6969
// create button
7070
this.button = $( '<a />', {
7171
href: '#' + this.ids.id,
72-
tabindex: ( tabindex ? tabindex : this.element.attr( 'disabled' ) ? -1 : 0 ),
72+
tabindex: ( tabindex ? tabindex : this.options.disabled ? -1 : 0 ),
7373
id: this.ids.button,
7474
css: {
7575
width: this.element.outerWidth()
@@ -174,8 +174,9 @@ $.widget( "ui.selectmenu", {
174174
this.menu.find( "li" ).not( '.ui-selectmenu-optgroup' ).find( 'a' ).attr( 'role', 'option' );
175175
this.menu.attr( "aria-activedescendant" , this.menu.find( "li.ui-menu-item a" ).eq( this.element[0].selectedIndex ).attr( "id" ) );
176176

177-
// transfer disabled state
178-
if ( this.element.attr( 'disabled' ) ) {
177+
// set and transfer disabled state
178+
this._getCreateOptions();
179+
if ( this.options.disabled ) {
179180
this.disable();
180181
} else {
181182
this.enable()
@@ -395,6 +396,14 @@ $.widget( "ui.selectmenu", {
395396
this.button.toggleClass( 'ui-corner-top', !this.isOpen ).toggleClass( 'ui-corner-all', this.isOpen );
396397
}
397398
},
399+
400+
_getCreateOptions: function() {
401+
if ( this.element.attr( 'disabled' ) ) {
402+
this.options.disabled = true;
403+
} else {
404+
this.options.disabled = false;
405+
}
406+
},
398407

399408
_readOptions: function() {
400409
var data = [];

0 commit comments

Comments
 (0)