Re: [csswg-drafts] [web-animations-2] Element.animate could allow keyframes to come from CSS declaration (#2070)

Yeah I was also expecting it would trigger a synchronous lookup, and the animation found (if any) would rely on the loaded stylesheets and media queries etc. at that moment in time.

Given the different behaviour of the `style` attribute, with animations being able to be updated with changes from stylesheets loading or matched media queries changing, the `new KeyframeEffect()` option may be clearer that this is a one-time lookup at that instant, whereas `Element.animate()` may be more likely to be interpreted as implying the animation somehow remains tied to the stylesheet - similar to when animating with the `style` attribute.

You can still trigger an animation easily enough with a constructed `KeyframeEffect`, so the functionality is essentially the same. The extra step of "do the lookup, _then_ use the new object to start an animation" might better match what is actually going on behind the scenes without implying any _extra_ magic.

-- 
GitHub Notification of comment by Cipscis
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2070#issuecomment-3941610296 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 22 February 2026 19:54:37 UTC