mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-05-17 02:51:07 +00:00
Reclaiming another 200-300 msecs on the 400 listview item page for iPad and WP7.5.
- Use $.data() instead of $.fn.data() in buttonMarkup(). - Avoid excess function overhead with a filtered children() call by walking the DOM ourselves in listview code.
This commit is contained in:
parent
de75527f78
commit
6bd8f7a85b
2 changed files with 20 additions and 6 deletions
|
|
@ -73,8 +73,8 @@ $.fn.buttonMarkup = function( options ) {
|
|||
buttonClass += " ui-shadow";
|
||||
}
|
||||
|
||||
el.attr( "data-" + $.mobile.ns + "theme", o.theme )
|
||||
.addClass( buttonClass );
|
||||
e.setAttribute( "data-" + $.mobile.ns + "theme", o.theme );
|
||||
el.addClass( buttonClass );
|
||||
|
||||
buttonInner.className = innerClass;
|
||||
buttonInner.setAttribute("aria-hidden", "true");
|
||||
|
|
@ -96,7 +96,7 @@ $.fn.buttonMarkup = function( options ) {
|
|||
// TODO obviously it would be nice to pull this element out instead of
|
||||
// retrieving it from the DOM again, but this change is much less obtrusive
|
||||
// and 1.0 draws nigh
|
||||
el.data( 'textWrapper', $( buttonText ) );
|
||||
$.data( e, 'textWrapper', $( buttonText ) );
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -115,7 +115,21 @@ $.widget( "mobile.listview", $.mobile.widget, {
|
|||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
_getChildrenByTagName: function( ele, lcName, ucName )
|
||||
{
|
||||
var results = [],
|
||||
dict = {};
|
||||
dict[ lcName ] = dict[ ucName ] = true;
|
||||
ele = ele.firstChild;
|
||||
while ( ele ) {
|
||||
if ( dict[ ele.nodeName ] ) {
|
||||
results.push( ele );
|
||||
}
|
||||
ele = ele.nextSibling;
|
||||
}
|
||||
return $( results );
|
||||
},
|
||||
|
||||
_addThumbClasses: function( containers )
|
||||
{
|
||||
var i, img, len = containers.length;
|
||||
|
|
@ -138,7 +152,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
|
|||
dividertheme = $list.jqmData( "dividertheme" ) || o.dividerTheme,
|
||||
listsplittheme = $list.jqmData( "splittheme" ),
|
||||
listspliticon = $list.jqmData( "spliticon" ),
|
||||
li = $list.children( "li" ),
|
||||
li = this._getChildrenByTagName( $list[ 0 ], "li", "LI" ),
|
||||
counter = $.support.cssPseudoElement || !$.nodeName( $list[ 0 ], "ol" ) ? 0 : 1,
|
||||
item, itemClass, itemTheme,
|
||||
a, last, splittheme, countParent, icon, imgParents, img;
|
||||
|
|
@ -154,7 +168,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
|
|||
// If we're creating the element, we update it regardless
|
||||
if ( create || !item.hasClass( "ui-li" ) ) {
|
||||
itemTheme = item.jqmData("theme") || o.theme;
|
||||
a = item.children( "a" );
|
||||
a = this._getChildrenByTagName( item[ 0 ], "a", "A" );
|
||||
|
||||
if ( a.length ) {
|
||||
icon = item.jqmData("icon");
|
||||
|
|
|
|||
Loading…
Reference in a new issue