Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Adding items to listviews on a4.1 is too slow #1424

stickybun opened this Issue · 4 comments

3 participants

Alex C Kin Blas CrushYar
Alex C

Adding items, and then refreshing a listview a4.1 on an iPhone4/4.3.1 is too slow. Even since commit 0ef9545
This was not the case on a3.

To recreate click 'double list' button on the following links to double a list of 20, and then 40.
a3: takes 113ms, 228ms
a4.1+: takes 1700ms, 6460ms

Kin Blas

Ok, I found the source of the slow down. It's due to this little nugget in listview's _itemApply():

    $list.find( "li" ).find( ">img:eq(0), >:first>img:eq(0)" ).addClass( "ui-li-thumb" ).each(function() {
        $( this ).closest( "li" ).addClass( $(this).is( ".ui-li-icon" ) ? "ui-li-has-icon" : "ui-li-has-thumb" );

For every list item, we're traversing the entire list to find all the first images of an li. Not really sure what this is about.

Kin Blas

I'll need to find out if this was what was really meant:

    item.children("img:eq(0)").add(item.children(":first > img:eq(0)")).addClass( "ui-li-thumb" ).each(function() {
        item.addClass( $(this).hasClass("ui-li-icon") ? "ui-li-has-icon" : "ui-li-has-thumb" );

Replacing the code in question with the code above, gets things into the ballpark of 1.0a3.

Kin Blas jblas was assigned
Kin Blas

Landed some changes that should make things better:


Kin Blas jblas closed this

I load data for list using ajax and after call listview('refresh'); ui-li-has-icon class not applied for items with
before this cpommit only first item was rendered without ui-li-has-icon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.