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

Commit

Permalink
[collapsibleset] Maintain ui-first-child and ui-last-child during ref…
Browse files Browse the repository at this point in the history
…resh()
  • Loading branch information
Gabriel Schulhof committed Nov 8, 2012
1 parent 263e908 commit 4d22d47
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions js/widgets/collapsibleSet.js
Expand Up @@ -56,19 +56,31 @@ $.widget( "mobile.collapsibleset", $.mobile.widget, {
var $el = this.element,
collapsiblesInSet = $el.children( ":jqmData(role='collapsible')" ),
expanded = collapsiblesInSet.filter( ":jqmData(collapsed='false')" );
this.refresh();
this._refresh( "true" );

// Because the corners are handled by the collapsible itself and the default state is collapsed
// That was causing https://github.com/jquery/jquery-mobile/issues/4116
expanded.trigger( "expand" );
},

refresh: function() {
_refresh: function( create ) {
var $el = this.element,
o = this.options,
collapsiblesInSet = $el.children( ":jqmData(role='collapsible')" );

$.mobile.collapsible.prototype.enhance( collapsiblesInSet.not( ".ui-collapsible" ) );
collapsiblesInSet.removeClass( "ui-first-child ui-last-child" );
if ( !create ) {
collapsiblesInSet = collapsiblesInSet.filter( ":visible" );
}
collapsiblesInSet
.eq( 0 ).addClass( "ui-first-child" )
.end()
.last().addClass( "ui-last-child" );
},

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

Expand Down

0 comments on commit 4d22d47

Please sign in to comment.