Adds a read-only animation attribute to the AnimationEvent and TransitionEvent interfaces. This attribute returns the associated Animation object that triggered the event.
When handling CSS animation or transition events (such as animationstart or transitionend), developers currently only receive metadata like the animation name or the CSS property name. If they want to programmatically interact with the triggering animation instance (e.g. to pause it, change its speed, or use its .finished promise), they must query the element or document using getAnimations() and filter the results. Providing direct access to the Animation instance via the animation attribute on the event object simplifies developer code, avoids costly DOM queries, and aligns with recent updates to the CSS Animations Level 2 and CSS Transitions Level 2 specifications.
Explainers: https://github.com/w3c/csswg-drafts/issues/9010