[csswg-drafts] [web-animations-1] Calling `cancel()` should dispatch a cancel event when the `startTime` is cleared

birtles has just created a new issue for https://github.com/w3c/csswg-drafts:

== [web-animations-1] Calling `cancel()` should dispatch a cancel event when the `startTime` is cleared ==
In the procedure to [cancel an animation](https://drafts.csswg.org/web-animations-1/#cancel-an-animation), we first check if the state is idle, and don't dispatch cancel events or reject the finished promise if it is.

However, it's possible to be in a state with a valid `startTime` but still be idle (e.g. when the animation has no timeline, or has an inactive timeline, and therefore the current time is unresolved). In that case, calling `cancel()` will clear the `startTime` and I would expect that it should also dispatch a cancel event to indicate that something was canceled (notably the `startTime`).

In other words, the only time calling `cancel()` should _not_ dispatch a cancel event is when it is truly a no-op. But perhaps it should dispatch it then too?

An example of the above case:
```js
const animation = new Animation(null, null);
animation.startTime = 100;
// At this point animation.playState === 'idle' because it has no timeline
animation.cancel();
// The above will reset animation.startTime to null
```

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2106 using your GitHub account

Received on Wednesday, 13 December 2017 00:46:33 UTC