From da1f7c762d36b646c107260f74daf3a0ab5f91f5 Mon Sep 17 00:00:00 2001 From: Brenton Date: Sat, 1 Jun 2013 23:29:18 -0700 Subject: [PATCH] fix(equals): {} and [] should not be considered equivalent angular.equals was returning inconsistent values for the comparison between {} and []: angular.equals({}, []) // true angular.equals([], {}]) // false Since these object are not of the same type, they should not be considered equivalent. --- src/Angular.js | 3 ++- test/AngularSpec.js | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Angular.js b/src/Angular.js index 8fd770962edd..362bc09bf219 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -665,6 +665,7 @@ function equals(o1, o2) { if (t1 == t2) { if (t1 == 'object') { if (isArray(o1)) { + if (!isArray(o2)) return false; if ((length = o1.length) == o2.length) { for(key=0; key