Currently, we list this as a limitation:
You cannot observe changes caused by CSS animations
However:
How about this:
- We listen to
animationstart
- When it fires, we use
document.getAnimations() to get metadata about the animation
- If it contains any of our observed properties, we add a
setInterval() that checks for changes until animationend or animationcancel fire for that animation.
For smooth results, we may need to reduce the throttle for these cases, so we may need a constant MIN_THROTTLE with the minimum throttle we need for style-observer to work properly in Safari < 18.2.
Currently, we list this as a limitation:
However:
document.getAnimations()How about this:
animationstartdocument.getAnimations()to get metadata about the animationsetInterval()that checks for changes untilanimationendoranimationcancelfire for that animation.For smooth results, we may need to reduce the throttle for these cases, so we may need a constant
MIN_THROTTLEwith the minimum throttle we need for style-observer to work properly in Safari < 18.2.