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

Commit

Permalink
[checkboxradio] Simplifying code in light of the fact that CSS mainta…
Browse files Browse the repository at this point in the history
…ins whether the icon is shown or not (as a function of whether the parent controlgroup is vertical resp. horizontal)
  • Loading branch information
Gabriel Schulhof committed Nov 12, 2012
1 parent 5e763a9 commit 9044789
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions js/widgets/forms/checkboxradio.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,23 +177,15 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {

refresh: function() {
var input = this.element[ 0 ],
horizontal = this.element.parents( ".ui-controlgroup-horizontal" ).length,
active = " " + $.mobile.activeBtnClass,
checkedClass = this.checkedClass + ( horizontal ? active : "" ),
icon, label = this.label;
checkedClass = this.checkedClass + ( this.element.parents( ".ui-controlgroup-horizontal" ).length ? active : "" ),
label = this.label;

if ( input.checked ) {
label.removeClass( this.uncheckedClass + active ).addClass( checkedClass );
icon = this.checkedicon;
label.removeClass( this.uncheckedClass + active ).addClass( checkedClass ).buttonMarkup( { icon: this.checkedicon } );
} else {
label.removeClass( checkedClass ).addClass( this.uncheckedClass );
icon = this.uncheckedicon;
label.removeClass( checkedClass ).addClass( this.uncheckedClass ).buttonMarkup( { icon: this.uncheckedicon } );
}
if ( horizontal ) {
icon = undefined;
}

label.buttonMarkup( { icon: icon } );

if ( input.disabled ) {
this.disable();
Expand Down

0 comments on commit 9044789

Please sign in to comment.