Skip to content

Commit 0da34c6

Browse files
committed
Button: adding classes option
1 parent 2ed49e2 commit 0da34c6

File tree

2 files changed

+9
-21
lines changed

2 files changed

+9
-21
lines changed

themes/base/button.css

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,6 @@ input.ui-button.ui-button-icon-only {
104104
padding: .4em 1em 1.1em 1em;
105105
}
106106

107-
.ui-button.ui-icon-notext .ui-icon {
108-
padding: 0;
109-
width: 2.1em;
110-
height: 2.1em;
111-
text-indent: -9999px;
112-
white-space: nowrap;
113-
114-
}
115-
116-
input.ui-button.ui-icon-notext .ui-icon {
117-
width: auto;
118-
height: auto;
119-
text-indent: 0;
120-
white-space: normal;
121-
padding: .4em 1em;
122-
}
123-
124107
/* workarounds */
125108
/* reset extra padding in Firefox, see h5bp.com/l */
126109
input.ui-button::-moz-focus-inner,

ui/button.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ $.widget( "ui.button", {
4242
showLabel: true,
4343
label: null,
4444
icon: null,
45-
iconPosition: "beginning"
45+
iconPosition: "beginning",
46+
classes: {
47+
"ui-button": "ui-corner-all",
48+
"ui-button-icon-only" : null,
49+
"ui-button-icon": null
50+
}
4651
},
4752

4853
_getCreateOptions: function() {
@@ -118,11 +123,11 @@ $.widget( "ui.button", {
118123

119124
_updateIcon: function( icon ) {
120125
if ( !this.icon ) {
121-
this.icon = $( "<span>" ).addClass( "ui-icon" );
126+
this.icon = $( "<span>" ).addClass( this._classes( "ui-button-icon" ) + " ui-icon" );
122127
this.element.addClass( "ui-icon-" + this.options.iconPosition );
123128

124129
if ( !this.options.showLabel ){
125-
this.element.addClass( "ui-button-icon-only" );
130+
this.element.addClass( this._classes( "ui-button-icon-only" ) );
126131
}
127132
} else {
128133
this.icon.removeClass( this.options.icon );
@@ -158,7 +163,7 @@ $.widget( "ui.button", {
158163
// Make sure we cant end up with a button that has no text nor icon
159164
if ( key === "showLabel" ) {
160165
if ( ( !value && !this.options.icon ) || value ) {
161-
this.element.toggleClass( "ui-button-icon-only", !value )
166+
this.element.toggleClass( this._classes( "ui-button-icon-only" ), !value )
162167
.toggleClass( this.options.iconPosition, !!value );
163168
this._updateTooltip();
164169
} else {

0 commit comments

Comments
 (0)