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:
f0353e8
)
Just pushed in my changes for making jQuery.each on objects faster, sample results...
author
John Resig
<jeresig@gmail.com>
Mon, 20 Aug 2007 07:04:00 +0000
(07:04 +0000)
committer
John Resig
<jeresig@gmail.com>
Mon, 20 Aug 2007 07:04:00 +0000
(07:04 +0000)
src/jquery/jquery.js
patch
|
blob
|
history
diff --git
a/src/jquery/jquery.js
b/src/jquery/jquery.js
index
5ffccc5
..
76b08ed
100644
(file)
--- a/
src/jquery/jquery.js
+++ b/
src/jquery/jquery.js
@@
-1391,17
+1391,23
@@
jQuery.extend({
*/
// args is for internal usage only
each: function( obj, fn, args ) {
*/
// args is for internal usage only
each: function( obj, fn, args ) {
- if ( obj.length == undefined )
- for ( var i in obj )
- fn.apply( obj[i], args || [i, obj[i]] );
- else if ( args ) {
- for ( var i = 0, ol = obj.length; i < ol; i++ )
- if ( fn.apply( obj[i], args ) === false ) break;
+ if ( args ) {
+ if ( obj.length == undefined )
+ for ( var i in obj )
+ fn.apply( obj[i], args );
+ else
+ for ( var i = 0, ol = obj.length; i < ol; i++ )
+ if ( fn.apply( obj[i], args ) === false ) break;
// A special, fast, case for the most common use of each
// 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] );
+ } else {
+ if ( obj.length == undefined )
+ for ( var i in obj )
+ fn.call( obj[i], i, obj[i] );
+ 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;
},