Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit bb49223

Browse files
author
Gabriel Schulhof
committed
[checkboxradio] Use .buttonMarkup() to update icon instead of class manipulation
1 parent 2e2d3dc commit bb49223

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

js/widgets/forms/checkboxradio.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
3737
activeBtn = icon ? "" : " " + $.mobile.activeBtnClass,
3838
checkedClass = "ui-" + checkedState + activeBtn,
3939
uncheckedClass = "ui-" + uncheckedState,
40-
checkedicon = "ui-icon-" + checkedState,
41-
uncheckedicon = "ui-icon-" + uncheckedState;
40+
checkedicon = checkedState,
41+
uncheckedicon = uncheckedState;
4242

4343
if ( inputtype !== "checkbox" && inputtype !== "radio" ) {
4444
return;
@@ -179,15 +179,12 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
179179

180180
refresh: function() {
181181
var input = this.element[0],
182-
label = this.label,
183-
icon = label.find( ".ui-icon" );
182+
label = this.label;
184183

185184
if ( input.checked ) {
186-
label.addClass( this.checkedClass ).removeClass( this.uncheckedClass );
187-
icon.addClass( this.checkedicon ).removeClass( this.uncheckedicon );
185+
label.addClass( this.checkedClass ).removeClass( this.uncheckedClass ).buttonMarkup( { icon: this.checkedicon } );
188186
} else {
189-
label.removeClass( this.checkedClass ).addClass( this.uncheckedClass );
190-
icon.removeClass( this.checkedicon ).addClass( this.uncheckedicon );
187+
label.removeClass( this.checkedClass ).addClass( this.uncheckedClass ).buttonMarkup( { icon: this.uncheckedicon } );;
191188
}
192189

193190
if ( input.disabled ) {

0 commit comments

Comments
 (0)