bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

$modal leaking DOM

Open mohuk opened this issue 12 years ago • 9 comments

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 avatar Oct 23 '14 06:10 mohuk

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

pkozlowski-opensource avatar Oct 24 '14 09:10 pkozlowski-opensource

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

mohuk avatar Oct 24 '14 10:10 mohuk

@pkozlowski-opensource

1102leak

This is what I get from v11.2

Plunkr: http://plnkr.co/NaRHkzfFLsyVlWtQCPoe

mohuk avatar Oct 24 '14 10:10 mohuk

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 avatar Oct 24 '14 10:10 chrisirhc

+1

lukasz-karolewski avatar Mar 28 '15 07:03 lukasz-karolewski

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

wesleycho avatar Aug 01 '15 17:08 wesleycho

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 avatar Aug 01 '15 18:08 chrisirhc

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

chrisirhc avatar Aug 01 '15 19:08 chrisirhc

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

mohuk avatar Aug 01 '15 22:08 mohuk