lukePeavey / SplitType

Javascript utility that splits text into lines, words, characters for animation
https://lukepeavey.github.io/SplitType/
545 stars 39 forks source link

Memory Leak Issue #40

Closed lukePeavey closed 2 years ago

lukePeavey commented 2 years ago

SplitType uses an internal data store (similar to jQuery's data method) to store arbitrary data on DOM elements.

Most of this data is temporary and gets removed at the end of the split function. However, I noticed that this is not working consistently when using SplitType in React applications. In some cases, the data store retains all of the data associated with split text nodes even after text has been reverted and those elements no longer exist. This could result is significant memory leak, as more data is accumulated with every SplitType call.

Also, a small amount of data (associated with the target elements) is currently retained even after text has been reverted. Reverting a splitType instance should remove all stored data associated with the target elements.