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

I just ran across this issue while trying to implement an API exactly like this in one of my own projects. I'd love to see it become part of the spec.

It looks like it's been some time since the last discussion on it though, and some things that have become widely available in the past seven years may make this a bit more complicated. For example, the Shadow DOM API allows for CSS encapsulation that might mean CSS keyframes with a certain name may exist for elements only in one particular shadow DOM, or only in the light DOM.

I don't think that would be a problem for an interface like this:
```typescript
Element.animate(keyframes: string, options?: number | KeyframeAnimationOptions)
```

But it would complicate the potential option of making it easy to discover or retrieve the available `CSSKeyframesRule` objects. At least, I expect that discovery would need to be done for a specific element, instead of being done directly on the document itself.

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


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

Received on Friday, 23 February 2024 03:55:03 UTC