Permalink
Browse files

[listview] Avoid filtering twice for ":visible"

  • Loading branch information...
gabrielschulhof committed Nov 9, 2012
1 parent c2f1e6e commit aafd5f2336634a05691d20dc196ccc3dfd661d8a
Showing with 8 additions and 1 deletion.
  1. +8 −1 js/widgets/listview.js
View
@@ -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" );

0 comments on commit aafd5f2

Please sign in to comment.