Just pushed some major speed improvements through for $.each() - we're now seeing a 2x speed improvement over 1.1.3. Some crude results can be found here: http://dev.jquery.com/~john/ticket/each/
This commit is contained in:
parent
2b05e24993
commit
f0353e89ab
10
src/jquery/jquery.js
vendored
10
src/jquery/jquery.js
vendored
|
@ -1394,9 +1394,15 @@ jQuery.extend({
|
||||||
if ( obj.length == undefined )
|
if ( obj.length == undefined )
|
||||||
for ( var i in obj )
|
for ( var i in obj )
|
||||||
fn.apply( obj[i], args || [i, obj[i]] );
|
fn.apply( obj[i], args || [i, obj[i]] );
|
||||||
else
|
else if ( args ) {
|
||||||
for ( var i = 0, ol = obj.length; i < ol; i++ )
|
for ( var i = 0, ol = obj.length; i < ol; i++ )
|
||||||
if ( fn.apply( obj[i], args || [i, obj[i]] ) === false ) break;
|
if ( fn.apply( obj[i], args ) === false ) break;
|
||||||
|
|
||||||
|
// A special, fast, case for the most common use of each
|
||||||
|
} else
|
||||||
|
for ( var i = 0, ol = obj.length, val = obj[0];
|
||||||
|
i < ol && fn.call(val,i,val) !== false; val = obj[++i] );
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue