git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2b05e24
)
Just pushed some major speed improvements through for $.each() - we're now seeing...
author
John Resig
<jeresig@gmail.com>
Mon, 20 Aug 2007 06:29:41 +0000
(06:29 +0000)
committer
John Resig
<jeresig@gmail.com>
Mon, 20 Aug 2007 06:29:41 +0000
(06:29 +0000)
src/jquery/jquery.js
patch
|
blob
|
history
diff --git
a/src/jquery/jquery.js
b/src/jquery/jquery.js
index
ff33034
..
5ffccc5
100644
(file)
--- a/
src/jquery/jquery.js
+++ b/
src/jquery/jquery.js
@@
-1394,9
+1394,15
@@
jQuery.extend({
if ( obj.length == undefined )
for ( var i in obj )
fn.apply( obj[i], args || [i, obj[i]] );
if ( obj.length == undefined )
for ( var i in obj )
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;
},