]> source.dussan.org Git - jquery-ui.git/commitdiff
Remove previous text/icon classes when updating buttons.
authorScott González <scott.gonzalez@gmail.com>
Fri, 30 Apr 2010 01:38:23 +0000 (21:38 -0400)
committerScott González <scott.gonzalez@gmail.com>
Fri, 30 Apr 2010 01:38:23 +0000 (21:38 -0400)
Fixes #5567 - button text, hide then show again.

ui/jquery.ui.button.js

index 4180f3613e05fdd89727e4648f9be4fbe51397b4..83f14f4c986371642c14767d6d5237d1485cf96f 100644 (file)
@@ -15,8 +15,8 @@
 
 var lastActive,
        baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
-       otherClasses = "ui-state-hover ui-state-active " +
-               "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon ui-button-text-only",
+       stateClasses = "ui-state-hover ui-state-active ",
+       typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon ui-button-text-only",
        formResetHandler = function( event ) {
                $( ":ui-button", event.target.form ).each(function() {
                        var inst = $( this ).data( "button" );
@@ -217,7 +217,7 @@ $.widget( "ui.button", {
                this.element
                        .removeClass( "ui-helper-hidden-accessible" );
                this.buttonElement
-                       .removeClass( baseClasses + " " + otherClasses )
+                       .removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
                        .removeAttr( "role" )
                        .removeAttr( "aria-pressed" )
                        .html( this.buttonElement.find(".ui-button-text").html() );
@@ -278,7 +278,7 @@ $.widget( "ui.button", {
                        }
                        return;
                }
-               var buttonElement = this.buttonElement,
+               var buttonElement = this.buttonElement.removeClass( typeClasses ),
                        buttonText = $( "<span></span>" )
                                .addClass( "ui-button-text" )
                                .html( this.options.label )