flackr / scroll-timeline

A polyfill of ScrollTimeline.
Apache License 2.0
951 stars 94 forks source link

Polyfill throws for older browsers not supporting `getAnimations()`. #159

Open calinoracation opened 1 year ago

calinoracation commented 1 year ago

Another one we're seeing in the wild: c.target.getAnimations is not a function. I worked around it in my forked version by doing a check for it, but also just wrapped a try/catch around the entire animationstart event as we've hit issues on a few parts of it now for older browsers.

https://caniuse.com/?search=getAnimations

Chrome 83 and older Safari 13 and older Firefox 74 and older

flackr commented 1 year ago

Without getAnimations the polyfill won't work for CSS scroll driven animations - but it should still work fine for those started with Element.animate. We can certainly add a workaround to avoid using getAnimations if not available.

calinoracation commented 1 year ago

Yeah I think that's helpful to not throw, especially with it happening on animationstart. We have tons of small animations so it saturated our logs even with a small amount of traffic exposure. I think it not working for those CSS ones when not available is reasonable, and honestly the browser versions throwing the error are outside of our support window, so it's not the biggest deal, but others might run into it as well and for us the errors in bugsnag, etc would be pretty noisy.