Skip to content

Commit c9bbd9a

Browse files
committed
Button: Only add text classes if there is text. Fixes #7040 - button class change breaks icon only buttons.
(cherry picked from commit e72afe4)
1 parent 9851398 commit c9bbd9a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ui/jquery.ui.button.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,9 @@ $.widget( "ui.button", {
294294
buttonClasses = [];
295295

296296
if ( icons.primary || icons.secondary ) {
297-
buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
297+
if ( this.options.text ) {
298+
buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
299+
}
298300

299301
if ( icons.primary ) {
300302
buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
@@ -306,7 +308,6 @@ $.widget( "ui.button", {
306308

307309
if ( !this.options.text ) {
308310
buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
309-
buttonElement.removeClass( "ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary" );
310311

311312
if ( !this.hasTitle ) {
312313
buttonElement.attr( "title", buttonText );

0 commit comments

Comments
 (0)