W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2017

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

From: Brian Birtles via GitHub <sysbot+gh@w3.org>
Date: Wed, 13 Dec 2017 00:46:00 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-281587528-1513125959-sysbot+gh@w3.org>
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

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:21 UTC