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

ui/widgets/menu.js

index f7fa2b65193e5c8c6b046fa01f67b45e8ddb0426..d42d65bacd1e4ec159acc73531bf94ff6b767ba2 100644 (file)
@@ -71,11 +71,6 @@ return $.widget( "ui.menu", {
                                tabIndex: 0
                        } );
 
-               if ( this.options.disabled ) {
-                       this._addClass( null, "ui-state-disabled" );
-                       this.element.attr( "aria-disabled", "true" );
-               }
-
                this._addClass( "ui-menu", "ui-widget ui-widget-content" );
                this._on( {
 
@@ -359,13 +354,16 @@ return $.widget( "ui.menu", {
                        this._removeClass( icons, null, this.options.icons.submenu )
                                ._addClass( icons, null, value.submenu );
                }
-               if ( key === "disabled" ) {
-                       this.element.attr( "aria-disabled", value );
-                       this._toggleClass( null, "ui-state-disabled", !!value );
-               }
                this._super( key, value );
        },
 
+       _setOptionDisabled: function( value ) {
+               this._super( value );
+
+               this.element.attr( "aria-disabled", String( value ) );
+               this._toggleClass( null, "ui-state-disabled", !!value );
+       },
+
        focus: function( event, item ) {
                var nested, focused, activeParent;
                this.blur( event, event && event.type === "focus" );