canjs / can-dom-data-state

A key/value store useful for associating data with DOM Nodes.
https://www.npmjs.com/package/can-dom-data-state
MIT License
0 stars 0 forks source link

setData causes a memory leak #21

Closed matthewp closed 6 years ago

matthewp commented 6 years ago

setData set up a mutation listener to delete internal state when the DOM node is removed.

https://github.com/canjs/can-dom-data-state/blob/4000533acdd5919745526a62734d61657e3ae58f/can-dom-data-state.js#L44

However the function it calls expects a DOM node as the this object (see here) so the state is never removed.