Hi.
I’m developing a SPA and Twitter’s widget.js javascript is causing a memory leak.
When only adding widget.js and removing it completly, it seems to be fine.
Once I use twttr.widgets.createTimeline(), then the problem comes up.
Here is a fiddle where I was even trying to manually ensuring that all attached events were removed.
https://jsfiddle.net/rulrok/82pmj53o/2/
When asking to create the timeline, a request is made to:
https://platform.twitter.com/js/timeline.b0a587d0d4f12c2689ad7e638140e2c7.js
I am suspecting that this leaving some event behind. I see there are pairs of eventListeners add and remove for click, but only one addEventListener for ‘load’ (I guess it is an iframe element).
I was trying to whack all and everything I could, but some references are kept in memory coming from ‘widget.js’.
I don’t know how widget.js and timeline.js interact.
Twitter js plugin is simply unreasonable for SPAs.