@@ -46,19 +46,19 @@ $.widget( "ui.button", {
46
46
iconPosition : "begining"
47
47
} ,
48
48
49
- _getCreateOptions : function ( ) {
49
+ _getCreateOptions : function ( ) {
50
50
var label ,
51
51
isDisabled = this . element . prop ( "disabled" ) ,
52
52
options = { } ;
53
53
54
54
this . isInput = this . element . is ( "input" ) ;
55
55
label = ( this . isInput ? this . element . val ( ) : this . element . html ( ) ) ;
56
56
57
- if ( typeof isDisabled !== "undefined" ) {
57
+ if ( typeof isDisabled !== "undefined" ) {
58
58
options . disabled = isDisabled ;
59
59
}
60
60
61
- if ( typeof label !== "undefined" && label !== "" ) {
61
+ if ( typeof label !== "undefined" && label !== "" ) {
62
62
options . label = label ;
63
63
}
64
64
@@ -75,34 +75,34 @@ $.widget( "ui.button", {
75
75
} else {
76
76
this . options . disabled = ! ! this . element . prop ( "disabled" ) ;
77
77
}
78
- if ( this . options . disabled === true ) {
78
+ if ( this . options . disabled === true ) {
79
79
this . _setOption ( "disabled" , true ) ;
80
80
}
81
81
82
82
this . element
83
83
. addClass ( baseClasses )
84
84
. attr ( "role" , "button" ) ;
85
85
86
- if ( this . options . icon ) {
86
+ if ( this . options . icon ) {
87
87
this . icon = $ ( "<span>" ) ;
88
88
this . icon . addClass ( " ui-icon " + this . options . icon ) ;
89
- if ( this . options . iconPosition ) {
89
+ if ( this . options . iconPosition ) {
90
90
this . element . addClass ( "ui-icon-" + this . options . iconPosition ) ;
91
91
}
92
- if ( ! this . options . showLabel ) {
92
+ if ( ! this . options . showLabel ) {
93
93
this . element . addClass ( " ui-button-icon-only" ) ;
94
94
}
95
95
this . element . append ( this . icon ) ;
96
96
this . _setTitle ( ) ;
97
97
}
98
- if ( this . options . label ) {
99
- if ( this . isInput ) {
98
+ if ( this . options . label ) {
99
+ if ( this . isInput ) {
100
100
this . element . val ( this . options . label ) ;
101
101
} else {
102
102
var textNode = this . element . contents ( ) . filter ( function ( ) {
103
103
return this . nodeType === 3 ;
104
104
} ) [ 0 ] ;
105
- if ( textNode !== undefined ) {
105
+ if ( textNode !== undefined ) {
106
106
textNode . nodeValue = this . options . label ;
107
107
} else {
108
108
this . element . html ( this . options . label + this . element . html ( ) ) ;
@@ -124,7 +124,7 @@ $.widget( "ui.button", {
124
124
this . title = this . element . attr ( "title" ) ;
125
125
this . hasTitle = ! ! this . title ;
126
126
127
- if ( ! this . options . showLabel ) {
127
+ if ( ! this . options . showLabel ) {
128
128
if ( ! this . hasTitle ) {
129
129
this . element . attr ( "title" , this . title ) ;
130
130
}
@@ -144,21 +144,21 @@ $.widget( "ui.button", {
144
144
} ,
145
145
146
146
_setOption : function ( key , value ) {
147
- if ( key === "icon" ) {
147
+ if ( key === "icon" ) {
148
148
this . icon . addClass ( " ui-icon " + value )
149
149
. removeClass ( this . options . icon ) ;
150
150
}
151
- if ( key === "showLabel" ) {
151
+ if ( key === "showLabel" ) {
152
152
this . element . toggleClass ( ".ui-button-icon-only" , ! ( ! ! value ) )
153
153
. toggleClass ( this . options . iconPosition , ! ! value ) ;
154
154
this . _setTitle ( ) ;
155
155
}
156
- if ( key === "iconPosition" && this . options . showLabel ) {
156
+ if ( key === "iconPosition" && this . options . showLabel ) {
157
157
this . element . addClass ( value )
158
158
. removeClass ( this . options . iconPosition ) ;
159
159
}
160
- if ( key === "label" ) {
161
- if ( this . element . is ( "input" ) ) {
160
+ if ( key === "label" ) {
161
+ if ( this . element . is ( "input" ) ) {
162
162
this . element . val ( value ) ;
163
163
} else {
164
164
this . element . html ( value ) ;
0 commit comments