-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Whitespace memleak #2019
Whitespace memleak #2019
Conversation
While this starts to solve the problem, i.e. empty white space nodes no longer receive a scope, I believe they may well still receive a copy of the controller due to this line in ng-view: https://github.com/angular/angular.js/blob/master/src/ng/directive/ngView.js#L150 |
test is good. but implementation could be more generically done via jqlite |
that fixes the issue in jqlite but not in jquery I'd prefer to create a fix that won't put data on text nodes. not attaching data to text nodes is IMO more important than remembering to clean up all this data. |
There are actually very few places where $.data appears:
|
otherwise this looks good to me. go ahead and make the final changes, squash and merge to master + v1.0.x |
One problem is do we need to ensure that the scope gets removed from $document or do we never do that? I.E. I tried this in a unit test:
which left the jQuery cache with an item on it - i.e. a memory leak?? But I guess that this is not the way to tidy up scope on the document? |
…ext nodes The change to prevent <span> elements being wrapped around empty text nodes caused these empty text nodes to have scopes and controllers attached, through jqLite.data() calls, which led to memory leaks and errors in IE8. Now we exclude all but document nodes and elements from having jqLite.data() set both in the compiler and in ng-view. Fixes: angular#1968 and angular#1876
turns out that this in fact is not an angular issue but a jquery issue: http://plnkr.co/edit/gWWCom4nnmtA8wKlq39p?p=preview try jumping between jquery 1.8, 1.9 and angular.element (jqlite) and you'll see that only 1.8 suffers from this issue (as well as from the related IE issue) |
How frustrating! I guess this doesn't change the PR since we still need to support jQuery 1.8? |
we'll keep this fix as is right now but we'll likely redo it during the jQuery 1.9 upgrade |
See this discussion: https://groups.google.com/forum/?hl=en-US&fromgroups=#!topic/angular/E01ZrbonZkQ