Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Some minor listview tweaking to eliminate 1200 $.fn.find calls in our…

… 400 item listview test case.

- Moved some of the finds we used to do for every item, out of the processing loop so we do just 3 big finds. This shaves off 200-300ms on iPad iOS 4.3.5.
  • Loading branch information...
commit e056d20728d032eebe0e63ec4384b31fc902bdbd 1 parent ebd7e04
@jblas jblas authored
Showing with 9 additions and 7 deletions.
  1. +9 −7 js/jquery.mobile.listview.js
View
16 js/jquery.mobile.listview.js
@@ -43,14 +43,8 @@ $.widget( "mobile.listview", $.mobile.widget, {
}
// TODO class has to be defined in markup
- item.find( "h1, h2, h3, h4, h5, h6" ).addClass( "ui-li-heading" ).end()
- .find( "p, dl" ).addClass( "ui-li-desc" ).end()
- .find( ">img:eq(0), .ui-link-inherit>img:eq(0)" ).addClass( "ui-li-thumb" ).each(function() {
+ item.find( ">img:eq(0), .ui-link-inherit>img:eq(0)" ).addClass( "ui-li-thumb" ).each(function() {
item.addClass( $(this).is( ".ui-li-icon" ) ? "ui-li-has-icon" : "ui-li-has-thumb" );
- }).end()
- .find( ".ui-li-aside" ).each(function() {
- var $this = $(this);
- $this.prependTo( $this.parent() ); //shift aside to front for css float
});
},
@@ -215,6 +209,14 @@ $.widget( "mobile.listview", $.mobile.widget, {
self._itemApply( $list, item );
}
+ $list.find( "h1, h2, h3, h4, h5, h6" ).addClass( "ui-li-heading" ).end()
+ .find( "p, dl" ).addClass( "ui-li-desc" ).end()
+ .find( ".ui-li-aside" ).each(function() {
+ var $this = $(this);
+ $this.prependTo( $this.parent() ); //shift aside to front for css float
+ });
+
+
this._refreshCorners( create );
},

0 comments on commit e056d20

Please sign in to comment.
Something went wrong with that request. Please try again.