- From: Majid Valipour via GitHub <sysbot+gh@w3.org>
- Date: Thu, 30 Apr 2020 18:03:40 +0000
- To: public-css-archive@w3.org
Thanks for the feedback. Let's add `timeline` to [`KeyframeAnimationOptions`](https://drafts.csswg.org/web-animations-1/#ref-for-dictdef-keyframeanimationoptions%E2%91%A1) which seems to be fairly straightforward.
As for matching the semantic of timeline param in `Animation` ctor, I believe if we use an optional nullable type then we should be able to differentiate between "explicit null", "not passing anything" cases.
For example I think the following IDL and text should give the desired behavior with the exact text as Animation constructor:
```webidl
dictionary KeyframeAnimationOptions : KeyframeEffectOptions {
DOMString id = "";
optional AnimationTimeline? timeline;
};
```
Animation constructor text:
> Run the procedure to set the timeline of an animation on animation passing
timeline as the new timeline or, if a timeline argument is **missing**,
passing the default document timeline of the Document associated with the
Window that is the current global object.
**Unspecified value case:**
Per [Webidl](https://heycam.github.io/webidl/#dictionary-member-optional) an
Unspecified optional value member is considered missing. So for:
```js
div.animate({/* keyframes*/ }, { duration: 1000});
```
We should receive a missing timeline value which we trun into
the default document timeline.
**Explicit null case:**
Since type is nullable passing null is valid and we will get null value which
we can pass into `set the timeline of an animation` procedure.
```js
div.animate({/* keyframes*/ }, { duration: 1000, timeline: null});
```
--
GitHub Notification of comment by majido
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5013#issuecomment-622012578 using your GitHub account
Received on Thursday, 30 April 2020 18:04:48 UTC