Permalink
Browse files

Button: Only add text classes if there is text. Fixes #7040 - button …

…class change breaks icon only buttons.

(cherry picked from commit e72afe4)
  • Loading branch information...
1 parent 9851398 commit c9bbd9aa6e8bd23e314f4e284aec3b18c6ad797c @scottgonzalez scottgonzalez committed Feb 26, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 ui/jquery.ui.button.js
View
@@ -294,7 +294,9 @@ $.widget( "ui.button", {
buttonClasses = [];
if ( icons.primary || icons.secondary ) {
- buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
+ if ( this.options.text ) {
+ buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
+ }
if ( icons.primary ) {
buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
@@ -306,7 +308,6 @@ $.widget( "ui.button", {
if ( !this.options.text ) {
buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
- buttonElement.removeClass( "ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary" );
if ( !this.hasTitle ) {
buttonElement.attr( "title", buttonText );

0 comments on commit c9bbd9a

Please sign in to comment.