Re: [csswg-drafts] [web-animations-1] Allow setting timeline in Element.animate() (#5013)

No I think they behave the same.

Correct me if I am wrong but here is the current `Animation()` behavior w.r.t timelines:

- explicit null: `new Animation(null, null)` => animation.timeline  is null
- explicit undefined: `new Animation(null, undefined)` => animation.timeline is document timeline
- implicit undefined: `new Animation(null)` => animation.timeline is document timeline

My quick [test](https://jsbin.com/fokibol/edit?js,output) shows the same in both Firefox and Chrome.

Here is the  proposed IDL and spec text which I also have #5033: 

```
dictionary KeyframeAnimationOptions : KeyframeEffectOptions {
    DOMString id = "";
    AnimationTimeline? timeline;
};
```
and the proposed spec text:

```
if <code>timeline</code> member of
<var>options</var> is missing, be the <a>default document timeline</a>
of the <a>node document</a> of the element on which this method was
called.
```

In this IDL the timeline is an **optional value** with **no default**.

So per earlier discussion of the conversion algorithm, passing `{ timeline: undefined }` and `{}` both leads to no having a missing member in the converted IDL dictionary which leads to us picking document timeline.

Passing `{timeline: null}` on the other hand would lead to having an IDL with its timeline member being null which
we set.

So I believe we have the same behavior as `Animation()`.


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

Received on Thursday, 7 May 2020 23:27:36 UTC