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

Commit

Permalink
[listview] Avoid filtering twice for ":visible"
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Schulhof committed Nov 9, 2012
1 parent c2f1e6e commit aafd5f2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/widgets/listview.js
Expand Up @@ -55,7 +55,14 @@ $.widget( "mobile.listview", $.mobile.widget, {

lis.removeClass( "ui-first-child ui-last-child" );
// At create time and when autodividers calls refresh the li are not visible yet so we need to rely on .ui-screen-hidden
visiblelis = create || lis.filter( ":visible" ).length === 0 ? lis.not( ".ui-screen-hidden" ) : lis.filter( ":visible" );
if ( create ) {
visiblelis = lis.not( ".ui-screen-hidden" );
} else {
visiblelis = lis.filter( ":visible" );
if ( visiblelis.length === 0 ) {
visiblelis = lis.not( ".ui-screen-hidden" );
}
}

visiblelis.eq( 0 ).addClass( "ui-first-child" ).end().last().addClass( "ui-last-child" );

Expand Down

0 comments on commit aafd5f2

Please sign in to comment.