@@ -294,11 +294,10 @@ jQuery.extend({
294294 } ,
295295
296296 each : function ( obj , callback ) {
297- var i = 0 ,
298- length = obj . length ,
299- isArray = isArraylike ( obj ) ;
297+ var length , i = 0 ;
300298
301- if ( isArray ) {
299+ if ( isArrayLike ( obj ) ) {
300+ length = obj . length ;
302301 for ( ; i < length ; i ++ ) {
303302 if ( callback . call ( obj [ i ] , i , obj [ i ] ) === false ) {
304303 break ;
@@ -327,7 +326,7 @@ jQuery.extend({
327326 var ret = results || [ ] ;
328327
329328 if ( arr != null ) {
330- if ( isArraylike ( Object ( arr ) ) ) {
329+ if ( isArrayLike ( Object ( arr ) ) ) {
331330 jQuery . merge ( ret ,
332331 typeof arr === "string" ?
333332 [ arr ] : arr
@@ -405,14 +404,13 @@ jQuery.extend({
405404
406405 // arg is for internal usage only
407406 map : function ( elems , callback , arg ) {
408- var value ,
407+ var length , value ,
409408 i = 0 ,
410- length = elems . length ,
411- isArray = isArraylike ( elems ) ,
412409 ret = [ ] ;
413410
414411 // Go through the array, translating each of the items to their new values
415- if ( isArray ) {
412+ if ( isArrayLike ( elems ) ) {
413+ length = elems . length ;
416414 for ( ; i < length ; i ++ ) {
417415 value = callback ( elems [ i ] , i , arg ) ;
418416
@@ -493,13 +491,13 @@ function(i, name) {
493491 class2type [ "[object " + name + "]" ] = name . toLowerCase ( ) ;
494492} ) ;
495493
496- function isArraylike ( obj ) {
494+ function isArrayLike ( obj ) {
497495
498496 // Support: iOS 8.2 (not reproducible in simulator)
499497 // `in` check used to prevent JIT error (gh-2145)
500498 // hasOwn isn't used here due to false negatives
501499 // regarding Nodelist length in IE
502- var length = "length" in obj && obj . length ,
500+ var length = ! ! obj && "length" in obj && obj . length ,
503501 type = jQuery . type ( obj ) ;
504502
505503 if ( type === "function" || jQuery . isWindow ( obj ) ) {
0 commit comments