Skip to content

An idea for how we can observe changes caused due to animations #87

@LeaVerou

Description

@LeaVerou

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions