homerjam / angular-scroll-magic

An angular directive for ScrollMagic, define pins and tweens in markup
http://homerjam.github.io/angular-scroll-magic/
MIT License
18 stars 6 forks source link

Presence of detached DOM nodes due to scrollmagic after the scope is destroyed #5

Open vinaynb opened 8 years ago

vinaynb commented 8 years ago

Hello,

I have prepared a simple example in angular wherein it contains two views one with a simple button (state A) and the other (state B) contains the code of the demo page that you have for this plugin (http://homerjam.github.io/angular-scroll-magic/)

When you go from state A to B and then back to A the dom nodes of B should be destroyed and retained by garbage collector. But on taking heap snapshots it shows detached dom nodes of state B which are retained somehow by scrollmagic's javascript. Maybe there's something we are missing to destroy when the scope of B is destroyed.

I have also used the original Scrollmagic lib and in that too i am facing this issue of detached dom nodes which i have reported there as well (https://github.com/janpaepke/ScrollMagic/issues/510) but unfortunately there hasn't been any progress on that thread.

The source code link is attached and i have just modified your repo's code to have two views and switching with UI router. You can switch views and then check the heap snapshots to find detached nodes SourceCode

Let me know if there's any confusion regarding this issue.

homerjam commented 8 years ago

Thanks for reporting. As you've noted I think this is an issue with ScrollMagic, I'll leave it open for now as reference for others.