mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Button: Only add text classes if there is text. Fixes #7040 - button class change breaks icon only buttons.
(cherry picked from commit e72afe4afc
)
This commit is contained in:
parent
98513985a2
commit
c9bbd9aa6e
3
ui/jquery.ui.button.js
vendored
3
ui/jquery.ui.button.js
vendored
@ -294,7 +294,9 @@ $.widget( "ui.button", {
|
|||||||
buttonClasses = [];
|
buttonClasses = [];
|
||||||
|
|
||||||
if ( icons.primary || icons.secondary ) {
|
if ( icons.primary || icons.secondary ) {
|
||||||
|
if ( this.options.text ) {
|
||||||
buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
|
buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
if ( icons.primary ) {
|
if ( icons.primary ) {
|
||||||
buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
|
buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
|
||||||
@ -306,7 +308,6 @@ $.widget( "ui.button", {
|
|||||||
|
|
||||||
if ( !this.options.text ) {
|
if ( !this.options.text ) {
|
||||||
buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
|
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 ) {
|
if ( !this.hasTitle ) {
|
||||||
buttonElement.attr( "title", buttonText );
|
buttonElement.attr( "title", buttonText );
|
||||||
|
Loading…
Reference in New Issue
Block a user