From 6da355c3e1571b9a104fca2796df77a4194a28a2 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Wed, 28 Mar 2012 16:03:59 -0700 Subject: refactor($compile): move methods of attr object into prototype We have many instances of this object and we clone them as well (e.g. ng-repeat). This should save some memory and performance as well. Double prefixed private properties of attr object: attr.$element -> attr.$$element attr.$observers -> attr.$$observers Update shallowCopy to not copy $$ properties and allow passing optional destination object. --- test/AngularSpec.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/AngularSpec.js') diff --git a/test/AngularSpec.js b/test/AngularSpec.js index da56449a..cf34305a 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -88,6 +88,15 @@ describe('angular', function() { expect(copy).toEqual(original); expect(copy.key).toBe(original.key); }); + + it('should not copy $$ properties nor prototype properties', function() { + var original = {$$some: true, $$: true}; + var clone = {}; + + expect(shallowCopy(original, clone)).toBe(clone); + expect(clone.$$some).toBeUndefined(); + expect(clone.$$).toBeUndefined(); + }); }); describe('elementHTML', function() { -- cgit v1.2.3