@@ -268,11 +268,10 @@ jQuery.extend({
268268 } ,
269269
270270 each : function ( obj , callback ) {
271- var i = 0 ,
272- length = obj . length ,
273- isArray = isArraylike ( obj ) ;
271+ var length , i = 0 ;
274272
275- if ( isArray ) {
273+ if ( isArrayLike ( obj ) ) {
274+ length = obj . length ;
276275 for ( ; i < length ; i ++ ) {
277276 if ( callback . call ( obj [ i ] , i , obj [ i ] ) === false ) {
278277 break ;
@@ -301,7 +300,7 @@ jQuery.extend({
301300 var ret = results || [ ] ;
302301
303302 if ( arr != null ) {
304- if ( isArraylike ( Object ( arr ) ) ) {
303+ if ( isArrayLike ( Object ( arr ) ) ) {
305304 jQuery . merge ( ret ,
306305 typeof arr === "string" ?
307306 [ arr ] : arr
@@ -355,14 +354,13 @@ jQuery.extend({
355354
356355 // arg is for internal usage only
357356 map : function ( elems , callback , arg ) {
358- var value ,
357+ var length , value ,
359358 i = 0 ,
360- length = elems . length ,
361- isArray = isArraylike ( elems ) ,
362359 ret = [ ] ;
363360
364361 // Go through the array, translating each of the items to their new values
365- if ( isArray ) {
362+ if ( isArrayLike ( elems ) ) {
363+ length = elems . length ;
366364 for ( ; i < length ; i ++ ) {
367365 value = callback ( elems [ i ] , i , arg ) ;
368366
@@ -441,13 +439,13 @@ function(i, name) {
441439 class2type [ "[object " + name + "]" ] = name . toLowerCase ( ) ;
442440} ) ;
443441
444- function isArraylike ( obj ) {
442+ function isArrayLike ( obj ) {
445443
446444 // Support: iOS 8.2 (not reproducible in simulator)
447445 // `in` check used to prevent JIT error (gh-2145)
448446 // hasOwn isn't used here due to false negatives
449447 // regarding Nodelist length in IE
450- var length = "length" in obj && obj . length ,
448+ var length = ! ! obj && "length" in obj && obj . length ,
451449 type = jQuery . type ( obj ) ;
452450
453451 if ( type === "function" || jQuery . isWindow ( obj ) ) {
0 commit comments