Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

$modal leaking DOM #2875

Closed
mohuk opened this issue Oct 23, 2014 · 9 comments
Closed

$modal leaking DOM #2875

mohuk opened this issue Oct 23, 2014 · 9 comments

Comments

@mohuk
Copy link

mohuk commented Oct 23, 2014

Hey

I created a simple app in which I open and close a modal. I realized with the three snapshot technique that the DOM is leaking. Here are the versions that I am using:

Angular JS: 1.3.0
Bootstrap: 3.2.0
UI-Bootstrap: 0.11.0

Here is a plunkr: http://plnkr.co/ByyPqhb1msBPi2Vw8dPj
dom-leak

Please let me know if I am doing something wrong or is it angular/angular-ui leaking the DOM?

Thanks

@mohuk mohuk changed the title Leaked DOM in modal $modal leaking DOM Oct 23, 2014
@pkozlowski-opensource
Copy link
Member

@mohammadumairkhan hmm, could you please check with 11.2 as there were some changes around modal's DOM management in this version?

@mohuk
Copy link
Author

mohuk commented Oct 24, 2014

@pkozlowski-opensource absolutely .. ill do that and get back to you

@mohuk
Copy link
Author

mohuk commented Oct 24, 2014

@pkozlowski-opensource

1102leak

This is what I get from v11.2

Plunkr: http://plnkr.co/NaRHkzfFLsyVlWtQCPoe

@chrisirhc
Copy link
Contributor

This seems to be only happening in AngularJS 1.3. I think the $parse service is caching some mouse events. Not sure if this is intended or a bug on AngularJS, haven't looked into it further.

@chrisirhc chrisirhc added this to the Purgatory milestone Nov 2, 2014
@lukasz-karolewski
Copy link

+1

@wesleycho
Copy link
Contributor

I did an investigation with an updated Plunker, and this is still an issue in master.

@wesleycho wesleycho modified the milestones: 0.13.3 (Performance), Purgatory Aug 1, 2015
@chrisirhc
Copy link
Contributor

Checking the Retainer tree reveals that this is due to ngAnimate storing a reference to the DOM element. It could be that we're (probably my fault) using $animate wrongly.

screen shot 2015-08-01 at 11 52 18 am

Disabling animations indeed removes those leaked nodes. (Plunker with disabled animations)

On further thought, this might be due to ngAnimate not being aware of the removal of the node.

@chrisirhc
Copy link
Contributor

Using $animate.leave instead of .remove() seems to solve this issue.
Plunker

@mohuk
Copy link
Author

mohuk commented Aug 1, 2015

thanks a lot guys .. its great to see progress on an issue opened long before. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants