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

Commit

Permalink
[controlgroup] Reinstate <= 1.2.0 functionality whereby running .cont…
Browse files Browse the repository at this point in the history
…rolgroup() on an already-enhanced controlgroup is the same as running .controlgroup( "refresh" )
  • Loading branch information
Gabriel Schulhof committed Nov 15, 2012
1 parent 0843c54 commit aa7a04b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions js/widgets/controlgroup.js
Expand Up @@ -38,14 +38,20 @@ define( [ "jquery",
}
$el.addClass( "ui-corner-all ui-controlgroup" );

$.extend( this, {
_initialRefresh: true
});

$.each( this.options, function( key, value ) {
// Cause initial options to be applied by their handler by temporarily setting the option to undefined
// - the handler then sets it to the initial value
self.options[ key ] = undefined;
self._setOption( key, value, true );
});
},

this._refresh( true );
_init: function() {
this.refresh();
},

_setOption: function( key, value ) {
Expand All @@ -63,7 +69,7 @@ define( [ "jquery",
this.element
.removeClass( "ui-controlgroup-horizontal ui-controlgroup-vertical" )
.addClass( "ui-controlgroup-" + value );
this._refresh( false );
this.refresh();
},

_setCorners: function( value ) {
Expand All @@ -82,16 +88,14 @@ define( [ "jquery",
return this.element.children( ".ui-controlgroup-controls" );
},

_refresh: function( create ) {
var els = this.element.find( ".ui-btn" ).not( ".ui-slider-handle" );
refresh: function() {
var els = this.element.find( ".ui-btn" ).not( ".ui-slider-handle" ),
create = this._initialRefresh;
if ( $.mobile.checkboxradio ) {
this.element.find( ":mobile-checkboxradio" ).checkboxradio( "refresh" );
}
this._addFirstLastClasses( els, this.options.excludeInvisible ? this._getVisibles( els, create ) : els, create );
},

refresh: function() {
this._refresh( false );
this._initialRefresh = false;
}
});

Expand Down

0 comments on commit aa7a04b

Please sign in to comment.