Permalink
Browse files

[checkboxradio] Simplifying code in light of the fact that CSS mainta…

…ins whether the icon is shown or not (as a function of whether the parent controlgroup is vertical resp. horizontal)
  • Loading branch information...
1 parent 5e763a9 commit 90447894f8ced968e82cfa63f964c12eef3e63e3 @gabrielschulhof gabrielschulhof committed Nov 12, 2012
Showing with 4 additions and 12 deletions.
  1. +4 −12 js/widgets/forms/checkboxradio.js
@@ -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();

0 comments on commit 9044789

Please sign in to comment.