Skip to content

Commit e72afe4

Browse files
committed
Button: Only add text classes if there is text. Fixes #7040 - button class change breaks icon only buttons.
1 parent 260a644 commit e72afe4

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
@@ -293,7 +293,9 @@ $.widget( "ui.button", {
293293
buttonClasses = [];
294294

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

298300
if ( icons.primary ) {
299301
buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
@@ -305,7 +307,6 @@ $.widget( "ui.button", {
305307

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

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

0 commit comments

Comments
 (0)