diff options
| -rw-r--r-- | src/Angular.js | 3 | ||||
| -rw-r--r-- | test/AngularSpec.js | 5 | 
2 files changed, 7 insertions, 1 deletions
| diff --git a/src/Angular.js b/src/Angular.js index a41ef4e8..4e050a0c 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -687,6 +687,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<length; key++) {              if (!equals(o1[key], o2[key])) return false; @@ -698,7 +699,7 @@ function equals(o1, o2) {        } else if (isRegExp(o1) && isRegExp(o2)) {          return o1.toString() == o2.toString();        } else { -        if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2)) return false; +        if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) || isArray(o2)) return false;          keySet = {};          for(key in o1) {            if (key.charAt(0) === '$' || isFunction(o1[key])) continue; diff --git a/test/AngularSpec.js b/test/AngularSpec.js index b43edf1c..a58b8109 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -289,6 +289,11 @@ describe('angular', function() {        expect(equals(/^abc/, /abc/)).toBe(false);        expect(equals(/^abc/, '/^abc/')).toBe(false);      }); + +    it('should return false when comparing an object and an array', function() { +      expect(equals({}, [])).toBe(false); +      expect(equals([], {})).toBe(false); +    });    });    describe('size', function() { | 
