@@ -59,14 +59,11 @@ $.widget( "ui.checkboxradio", {
59
59
label : null ,
60
60
icon : true ,
61
61
classes : {
62
- "ui-checkboxradio" : null ,
63
- "ui-checkboxradio-checkbox" : null ,
64
- "ui-checkboxradio-radio" : null ,
65
- "ui-checkboxradio-checkbox-label" : "ui-corner-all" ,
66
- "ui-checkboxradio-radio-label" : "ui-corner-all" ,
62
+ "ui-checkboxradio" : "" ,
63
+ "ui-checkboxradio-label" : "ui-corner-all" ,
64
+ "ui-checkboxradio-radio-label" : "" ,
67
65
"ui-checkboxradio-icon" : "ui-corner-all" ,
68
- "ui-checkboxradio-radio-checked" : null ,
69
- "ui-checkboxradio-checkbox-checked" : null
66
+ "ui-checkboxradio-checked" : ""
70
67
}
71
68
} ,
72
69
@@ -177,10 +174,14 @@ $.widget( "ui.checkboxradio", {
177
174
this . element . addClass ( "ui-helper-hidden-accessible " +
178
175
this . _classes ( "ui-checkboxradio" ) ) ;
179
176
180
- this . label . addClass ( baseClasses + " " + this . _classes ( "ui-checkboxradio-" + this . type + "-label" ) ) ;
177
+ this . label . addClass ( baseClasses + " " + this . _classes ( "ui-checkboxradio-label" ) ) ;
178
+
179
+ if ( this . type === "radio" ) {
180
+ this . label . addClass ( "ui-checkboxradio-radio-label" ) ;
181
+ }
181
182
182
183
if ( checked ) {
183
- this . label . addClass ( this . _classes ( "ui-checkboxradio-" + this . type + "- checked" ) +
184
+ this . label . addClass ( this . _classes ( "ui-checkboxradio-checked" ) +
184
185
" ui-state-active" ) ;
185
186
}
186
187
if ( this . options . label && this . options . label !== this . originalLabel ) {
@@ -196,7 +197,7 @@ $.widget( "ui.checkboxradio", {
196
197
197
198
_toggleClasses : function ( ) {
198
199
var checked = this . element . is ( ":checked" ) ;
199
- this . label . toggleClass ( this . _classes ( "ui-checkboxradio-" + this . type + "- checked" ) +
200
+ this . label . toggleClass ( this . _classes ( "ui-checkboxradio-checked" ) +
200
201
" ui-state-active" , checked ) ;
201
202
if ( this . options . icon && this . type === "checkbox" ) {
202
203
this . icon
@@ -209,12 +210,12 @@ $.widget( "ui.checkboxradio", {
209
210
. map ( function ( ) {
210
211
return $ ( this ) . checkboxradio ( "widget" ) [ 0 ] ;
211
212
} )
212
- . removeClass ( "ui-state-active " + this . _classes ( "ui-checkboxradio-radio- checked" ) ) ;
213
+ . removeClass ( "ui-state-active " + this . _classes ( "ui-checkboxradio-checked" ) ) ;
213
214
}
214
215
} ,
215
216
216
217
_destroy : function ( ) {
217
- this . label . removeClass ( this . _classes ( "ui-checkboxradio-radio-label ui-checkboxradio-checkbox- label" ) + " " +
218
+ this . label . removeClass ( this . _classes ( "ui-checkboxradio-radio-label ui-checkboxradio-label" ) + " " +
218
219
baseClasses + " " + typeClasses ) ;
219
220
if ( this . icon ) {
220
221
this . icon . remove ( ) ;
@@ -228,17 +229,10 @@ $.widget( "ui.checkboxradio", {
228
229
checkedType = parts [ 2 ] === this . type || parts [ 2 ] === undefined ,
229
230
checkedClass = parts [ 3 ] === "checked" || this . element . is ( ":checked" ) ;
230
231
switch ( classKey ) {
231
- case "ui-checkboxradio-radio" :
232
- case "ui-checkboxradio-checkbox" :
233
- if ( ! checkedType ) {
234
- return $ ( ) ;
235
- }
236
- break ;
237
232
case "ui-checkboxradio" :
238
233
case "ui-checkboxradio-radio-label" :
239
- case "ui-checkboxradio-checkbox-label" :
240
- case "ui-checkboxradio-radio-checked" :
241
- case "ui-checkboxradio-checkbox-checked" :
234
+ case "ui-checkboxradio-label" :
235
+ case "ui-checkboxradio-checked" :
242
236
if ( checkedType && checkedClass ) {
243
237
return this . label ;
244
238
}
@@ -296,7 +290,7 @@ $.widget( "ui.checkboxradio", {
296
290
var checked = this . element . is ( ":checked" ) ,
297
291
isDisabled = this . element . is ( ":disabled" ) ;
298
292
this . _updateIcon ( checked ) ;
299
- this . label . toggleClass ( "ui-state-active " + this . _classes ( "ui-" + this . type + " -checked" ) , checked ) ;
293
+ this . label . toggleClass ( "ui-state-active " + this . _classes ( "ui-checkboxradio -checked" ) , checked ) ;
300
294
if ( this . options . label !== null ) {
301
295
this . label . contents ( ) . not ( this . element . add ( this . icon ) ) . remove ( ) ;
302
296
this . label . append ( this . options . label ) ;
0 commit comments