git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
jquery core: Closes #2827. jQuery.each iterates over functions
[jquery.git]
/
src
/
core.js
diff --git
a/src/core.js
b/src/core.js
index
9d0d41f
..
78f48d7
100644
(file)
--- a/
src/core.js
+++ b/
src/core.js
@@
-307,10
+307,12
@@
jQuery.extend({
// args is for internal usage only
each: function( object, callback, args ) {
// args is for internal usage only
each: function( object, callback, args ) {
- var name, i = 0, length = object.length;
+ var name, i = 0,
+ length = object.length,
+ isObj = length === undefined || jQuery.isFunction(object);
if ( args ) {
if ( args ) {
- if ( length === undefined ) {
+ if ( isObj ) {
for ( name in object ) {
if ( callback.apply( object[ name ], args ) === false ) {
break;
for ( name in object ) {
if ( callback.apply( object[ name ], args ) === false ) {
break;
@@
-326,7
+328,7
@@
jQuery.extend({
// A special, fast, case for the most common use of each
} else {
// A special, fast, case for the most common use of each
} else {
- if ( length === undefined ) {
+ if ( isObj ) {
for ( name in object ) {
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
break;
for ( name in object ) {
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
break;