]> source.dussan.org Git - jquery-ui.git/commitdiff
Selectmenu: Remove redundant handling of disabled option on create
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Mon, 21 Sep 2015 11:01:13 +0000 (13:01 +0200)
committerScott González <scott.gonzalez@gmail.com>
Fri, 25 Sep 2015 17:47:09 +0000 (13:47 -0400)
Ref #9151
Ref gh-1599

ui/widgets/selectmenu.js

index 820e68570545edcec08d43ce78157d10daa6ce9c..30d8c71af6327536636595f05a1c609eebffaf14 100644 (file)
@@ -79,10 +79,6 @@ return $.widget( "ui.selectmenu", {
 
                this._rendered = false;
                this.menuItems = $();
-
-               if ( this.options.disabled ) {
-                       this.disable();
-               }
        },
 
        _drawButton: function() {
@@ -562,25 +558,27 @@ return $.widget( "ui.selectmenu", {
                        this.menuWrap.appendTo( this._appendTo() );
                }
 
-               if ( key === "disabled" ) {
-                       this.menuInstance.option( "disabled", value );
-                       this.button.attr( "aria-disabled", value );
-                       this._toggleClass( this.button, null, "ui-state-disabled", value );
-
-                       this.element.prop( "disabled", value );
-                       if ( value ) {
-                               this.button.attr( "tabindex", -1 );
-                               this.close();
-                       } else {
-                               this.button.attr( "tabindex", 0 );
-                       }
-               }
-
                if ( key === "width" ) {
                        this._resizeButton();
                }
        },
 
+       _setOptionDisabled: function( value ) {
+               this._super( value );
+
+               this.menuInstance.option( "disabled", value );
+               this.button.attr( "aria-disabled", value );
+               this._toggleClass( this.button, null, "ui-state-disabled", value );
+
+               this.element.prop( "disabled", value );
+               if ( value ) {
+                       this.button.attr( "tabindex", -1 );
+                       this.close();
+               } else {
+                       this.button.attr( "tabindex", 0 );
+               }
+       },
+
        _appendTo: function() {
                var element = this.options.appendTo;