aboutsummaryrefslogtreecommitdiffstats
path: root/src/core.js
diff options
context:
space:
mode:
authorDaniel Husar <dano.husar@gmail.com>2014-02-07 10:30:13 +0000
committerRichard Gibson <richard.gibson@gmail.com>2014-12-09 01:46:22 -0500
commiteeda11cdd6a69ec2ef4e9c1ed12b82a79910fda5 (patch)
treeb0207a8500f7c3a8ec69dbed489b3017dea3d294 /src/core.js
parentf6302b0b53d61dfe1adbfaf6612be5cbced5bbc1 (diff)
downloadjquery-eeda11cdd6a69ec2ef4e9c1ed12b82a79910fda5.tar.gz
jquery-eeda11cdd6a69ec2ef4e9c1ed12b82a79910fda5.zip
Core: Simplify and speed up .each
Closes gh-1510
Diffstat (limited to 'src/core.js')
-rw-r--r--src/core.js19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/core.js b/src/core.js
index 0dd80dd33..fa8436a01 100644
--- a/src/core.js
+++ b/src/core.js
@@ -277,25 +277,20 @@ jQuery.extend({
// args is for internal usage only
each: function( obj, callback, args ) {
- var value,
- i = 0,
+ var i = 0,
length = obj.length,
isArray = isArraylike( obj );
if ( args ) {
if ( isArray ) {
for ( ; i < length; i++ ) {
- value = callback.apply( obj[ i ], args );
-
- if ( value === false ) {
+ if ( callback.apply( obj[ i ], args ) === false ) {
break;
}
}
} else {
for ( i in obj ) {
- value = callback.apply( obj[ i ], args );
-
- if ( value === false ) {
+ if ( callback.apply( obj[ i ], args ) === false ) {
break;
}
}
@@ -305,17 +300,13 @@ jQuery.extend({
} else {
if ( isArray ) {
for ( ; i < length; i++ ) {
- value = callback.call( obj[ i ], i, obj[ i ] );
-
- if ( value === false ) {
+ if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
break;
}
}
} else {
for ( i in obj ) {
- value = callback.call( obj[ i ], i, obj[ i ] );
-
- if ( value === false ) {
+ if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
break;
}
}