-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Line Chart and, I assume, its legend produce a lot of unnecessary DOM nodes which are never being removed.
Steps to reproduce:
- Open this https://jsfiddle.net/g9amwjo8/
- Note that there are three truncated elements in the legend and take a look that in the body(the one inside iframe, where jsfiddle renders chart) there are three DOM nodes created in the bottom.
This DOM nodes (orphans) do not have any class name, id or data attribute, which would allow us to identify them. - Try to zoom in and out chart multiple times OR use pagination inside legend several times.
Actual result:
Every chart interaction creates a yet another batch of nodes in the body and does not remove old ones.
Expected result:
No orphan nodes after interactions with the chart
We encountered that bug in our SPA with client side routing. After working with the chart and leaving the page a lot of nodes were still in the DOM. These orphans led to extra memory consumption and slow DOM operations.
We noticed however, that extra .draw() call removes old nodes and creates new ones. But there is no way to clean everything after you stopped working with the google chart. We can't even identify these orphans, because there are no id, class or other attribute that would allow us to remove them manually.
It would be useful to have something like: .destroy() in the api, or at least a specific classname on these nodes.