]> source.dussan.org Git - jquery-ui.git/commitdiff
fixed: enable and disable has been swapped (regression), see #312
authorFelix Nagel <info@felixnagel.com>
Sat, 7 Sep 2013 17:03:49 +0000 (19:03 +0200)
committerFelix Nagel <info@felixnagel.com>
Sat, 7 Sep 2013 17:03:49 +0000 (19:03 +0200)
demos/selectmenu/disable_enable.html
ui/jquery.ui.selectmenu.js

index 020296c35f155c3df3b49a8556e7846428fdcf2a..1191150bafd5489e5530dad604b3ec788f415709 100644 (file)
                        var speedB2 = $('select#speedB2').selectmenu();                 
                        $("#optionSwitch").toggle(
                                function(){
-                                       speedB2.selectmenu("enable", 2);
+                                       speedB2.selectmenu("disable", 2);
                                }, 
                                function(){
-                                       speedB2.selectmenu("disable", 2);
+                                       speedB2.selectmenu("enable", 2);
                                }
                        );                      
                        
                        var speedD2 = $('select#speedD2').selectmenu();                         
                        $("#optgroupSwitch").toggle(
                                function(){
-                                       speedD2.selectmenu("enable", 1, "optgroup");
+                                       speedD2.selectmenu("disable", 1, "optgroup");
                                }, 
                                function(){
-                                       speedD2.selectmenu("disable", 1, "optgroup");
+                                       speedD2.selectmenu("enable", 1, "optgroup");
                                }
                        );                      
 
index aeb4551474c9a58c6b0730e7d63bfaa5eda39982..d5217c09f93c77b8c267664adfe407a781b79ec4 100644 (file)
@@ -747,12 +747,12 @@ $.widget("ui.selectmenu", {
                var optionElem = this._optionLis.eq( index );
                if ( optionElem ) {
                                optionElem
-                                       .toggleClass( 'ui-state-disabled', flag )
-                                       .find( "a" ).attr( "aria-disabled", !flag );
+                                       .toggleClass( 'ui-state-disabled', !flag )
+                                       .find( "a" ).attr( "aria-disabled", flag );
                        if ( flag ) {
-                               this.element.find( "option" ).eq( index ).attr( "disabled", "disabled" );
-                       } else {
                                this.element.find( "option" ).eq( index ).removeAttr( "disabled" );
+                       } else {
+                               this.element.find( "option" ).eq( index ).attr( "disabled", "disabled" );
                        }
                }
        },
@@ -762,12 +762,12 @@ $.widget("ui.selectmenu", {
                        var optGroupElem = this.list.find( 'li.ui-selectmenu-group-' + index );
                        if ( optGroupElem ) {
                                optGroupElem
-                                       .toggleClass( 'ui-state-disabled', flag )
-                                       .attr( "aria-disabled", !flag );
+                                       .toggleClass( 'ui-state-disabled', !flag )
+                                       .attr( "aria-disabled", flag );
                                if ( flag ) {
-                                       this.element.find( "optgroup" ).eq( index ).attr( "disabled", "disabled" );
-                               } else {
                                        this.element.find( "optgroup" ).eq( index ).removeAttr( "disabled" );
+                               } else {
+                                       this.element.find( "optgroup" ).eq( index ).attr( "disabled", "disabled" );
                                }
                        }
        },