versoly / taos

A simple and small (600 bytes) library to help animate elements while scrolling using responsive Tailwind CSS JIT utility classes.
MIT License
229 stars 8 forks source link

Fix errors caused by mutations on certain elements #2

Closed tpett closed 1 year ago

tpett commented 1 year ago

In my use case, we are having to modify the d attribute on a path element inside of an svg tag. This is triggering the MutationObserver. However, the Node object returned by the path element in javascript is not compatible with the expectations in this observer. It still has a className property, but it is not a string type but a SVGAnimatedString. This SVGAnimatedString type does not have an includes property causing these calls to error out.

While it may not be the most elegant fix, adding in a check to see if the includes property is defined fixes this error in my specific use case.