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

Commit

Permalink
[collapsibleSet] Update first/last classes using common behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Schulhof committed Nov 9, 2012
1 parent 4c9cb3d commit 07c3339
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions js/widgets/collapsibleSet.js
Expand Up @@ -5,7 +5,7 @@
//>>css.structure: ../css/structure/jquery.mobile.collapsible.css
//>>css.theme: ../css/themes/default/jquery.mobile.theme.css

define( [ "jquery", "../jquery.mobile.widget", "./collapsible" ], function( $ ) {
define( [ "jquery", "../jquery.mobile.widget", "./collapsible", "./addFirstLastClasses" ], function( $ ) {
//>>excludeEnd("jqmBuildExclude");
(function( $, undefined ) {

Expand Down Expand Up @@ -64,26 +64,20 @@ $.widget( "mobile.collapsibleset", $.mobile.widget, {
},

_refresh: function( create ) {
var $el = this.element,
o = this.options,
collapsiblesInSet = $el.children( ":jqmData(role='collapsible')" );
var collapsiblesInSet = this.element.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" );

this._addFirstLastClasses( collapsiblesInSet, this._getVisibles( collapsiblesInSet, create ), create );
},

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

$.widget( "mobile.collapsibleset", $.mobile.collapsibleset, $.mobile.behaviors.addFirstLastClasses );

//auto self-init widgets
$( document ).bind( "pagecreate create", function( e ) {
$.mobile.collapsibleset.prototype.enhanceWithin( e.target );
Expand Down

0 comments on commit 07c3339

Please sign in to comment.