From e72afe4afca0795fc785114cfeafbe08f5e2fdf3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Sat, 26 Feb 2011 11:13:00 +0100 Subject: [PATCH] Button: Only add text classes if there is text. Fixes #7040 - button class change breaks icon only buttons. --- ui/jquery.ui.button.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index d2458aa3c..134dae3d3 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -293,7 +293,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( "" ); @@ -305,7 +307,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 ); -- 2.39.5