From ec1c5dfaee32f9638cedd28bb96bbbecce9d0cf0 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 9 May 2012 19:27:15 -0400 Subject: fix(jqLite): .data()/.bind() memory leak Since angular attaches scope/injector/controller into DOM it should clean up after itself. No need to complain about memory leaks, since they can only happened on detached DOM. Detached DOM would only be in tests, since in production the DOM would be attached to render tree and removal would automatically clear memory. --- test/jqLiteSpec.js | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'test/jqLiteSpec.js') diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index f159e08f..406b7a5a 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -291,11 +291,37 @@ describe('jqLite', function() { expect(element.data()).toEqual({meLike: 'turtles', youLike: 'carrots', existing: 'val'}); expect(element.data()).toBe(oldData); // merge into the old object }); + + describe('data cleanup', function() { + it('should remove data on element removal', function() { + var div = jqLite('