Skip to content

Commit d2f6204

Browse files
jzaeffererscottgonzalez
authored andcommitted
Selectmenu: Remove redundant handling of disabled option on create
Ref #9151 Ref gh-1599
1 parent 7ceaa61 commit d2f6204

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

ui/widgets/selectmenu.js

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ return $.widget( "ui.selectmenu", {
7979

8080
this._rendered = false;
8181
this.menuItems = $();
82-
83-
if ( this.options.disabled ) {
84-
this.disable();
85-
}
8682
},
8783

8884
_drawButton: function() {
@@ -562,25 +558,27 @@ return $.widget( "ui.selectmenu", {
562558
this.menuWrap.appendTo( this._appendTo() );
563559
}
564560

565-
if ( key === "disabled" ) {
566-
this.menuInstance.option( "disabled", value );
567-
this.button.attr( "aria-disabled", value );
568-
this._toggleClass( this.button, null, "ui-state-disabled", value );
569-
570-
this.element.prop( "disabled", value );
571-
if ( value ) {
572-
this.button.attr( "tabindex", -1 );
573-
this.close();
574-
} else {
575-
this.button.attr( "tabindex", 0 );
576-
}
577-
}
578-
579561
if ( key === "width" ) {
580562
this._resizeButton();
581563
}
582564
},
583565

566+
_setOptionDisabled: function( value ) {
567+
this._super( value );
568+
569+
this.menuInstance.option( "disabled", value );
570+
this.button.attr( "aria-disabled", value );
571+
this._toggleClass( this.button, null, "ui-state-disabled", value );
572+
573+
this.element.prop( "disabled", value );
574+
if ( value ) {
575+
this.button.attr( "tabindex", -1 );
576+
this.close();
577+
} else {
578+
this.button.attr( "tabindex", 0 );
579+
}
580+
},
581+
584582
_appendTo: function() {
585583
var element = this.options.appendTo;
586584

0 commit comments

Comments
 (0)