From 7ec2c8d53c410e98a8370f626ec5b3cc0543ef70 Mon Sep 17 00:00:00 2001 From: Alex Rohde Date: Tue, 4 Jun 2013 22:11:35 -0700 Subject: [PATCH] fix(Angular.js): Improve logic powering isArrayLike() Enable isArrayLike() to correctly identify one-off-arrays (aka 'subclasses'). Thus array-like objects with enhanced prototypes can be used with ng-repeat. Previously, they would be misidentified as objects and not iterate correctly. --- src/Angular.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Angular.js b/src/Angular.js index 952e7a1d41a9..2a1cf5ac6c39 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -98,7 +98,8 @@ function isArrayLike(obj) { return obj instanceof JQLite || // JQLite (jQuery && obj instanceof jQuery) || // jQuery toString.call(obj) !== '[object Object]' || // some browser native object - typeof obj.callee === 'function'; // arguments (on IE8 looks like regular obj) + typeof obj.callee === 'function' || // arguments (on IE8 looks like regular obj) + obj.constructor === [].constructor; // various one-off objects (like subclasses) of array } }