Skip to content

Commit aafe0da

Browse files
committed
[web-animations-1] Add annotations describing exceptions thrown by the API
Fixes #2050.
1 parent 3845cfb commit aafe0da

1 file changed

Lines changed: 112 additions & 3 deletions

File tree

web-animations-1/Overview.bs

Lines changed: 112 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4589,6 +4589,15 @@ Programming interface {#programming-interface}
45894589

45904590
</div>
45914591

4592+
Exception annotations in this section list exceptions
4593+
that originate from algorithms in this specification.
4594+
They do not repeat exceptions produced by
4595+
converting values according to Web IDL.
4596+
The procedures for processing keyframes also propagate exceptions
4597+
thrown by author-defined property accessors or iterator methods.
4598+
Since such exceptions can be of any type,
4599+
they are not enumerated in these annotations.
4600+
45924601
Time values in the programming interface {#time-values-in-the-programming-interface}
45934602
----------------------------------------
45944603

@@ -4901,8 +4910,8 @@ The {{Animation}} interface {#the-animation-interface}
49014910

49024911
: {{DOMException}} of type "{{InvalidStateError}}"
49034912
::
4904-
Raised if this animation's [=playback rate=] is zero,
4905-
or if this animation's [=playback rate=] is > zero
4913+
Raised if this animation's [=effective playback rate=] is zero,
4914+
or if this animation's [=effective playback rate=] is > zero
49064915
and the [=associated effect end=] is infinity.
49074916

49084917
</div>
@@ -4913,12 +4922,33 @@ The {{Animation}} interface {#the-animation-interface}
49134922
by running the procedure to [=play an animation=]
49144923
passing true as the value of the |auto-rewind| flag.
49154924

4925+
<div class=exceptions>
4926+
4927+
: {{DOMException}} of type "{{InvalidStateError}}"
4928+
::
4929+
Raised if this animation's [=effective playback rate=] is negative,
4930+
the [=associated effect end=] is infinity,
4931+
and its [=animation/current time=] is unresolved
4932+
or less than or equal to zero.
4933+
4934+
</div>
4935+
49164936
: <dfn lt="pause()">void pause()</dfn>
49174937
::
49184938
Suspends the playback of this animation
49194939
by running the procedure to [=pause an animation=]
49204940
for this object.
49214941

4942+
<div class=exceptions>
4943+
4944+
: {{DOMException}} of type "{{InvalidStateError}}"
4945+
::
4946+
Raised if this animation's [=animation/current time=] is unresolved,
4947+
its [=playback rate=] is negative,
4948+
and the [=associated effect end=] is infinity.
4949+
4950+
</div>
4951+
49224952
<wpt>
49234953
interfaces/Animation/pause.html
49244954
</wpt>
@@ -4950,6 +4980,18 @@ The {{Animation}} interface {#the-animation-interface}
49504980
if the animation has already finished playing in the reversed direction,
49514981
[=seeks=] to the start of the [=associated effect=].
49524982

4983+
<div class=exceptions>
4984+
4985+
: {{DOMException}} of type "{{InvalidStateError}}"
4986+
::
4987+
Raised if this animation has no associated [=active timeline=],
4988+
or if its reversed [=effective playback rate=] would be negative,
4989+
the [=associated effect end=] is infinity,
4990+
and its [=animation/current time=] is unresolved
4991+
or less than or equal to zero.
4992+
4993+
</div>
4994+
49534995
: <dfn lt="persist()">void persist()</dfn>
49544996
::
49554997
Sets this animation's [=replace state=]
@@ -4966,6 +5008,19 @@ The {{Animation}} interface {#the-animation-interface}
49665008
calling this method <em>does</em> trigger a [=style change event=]
49675009
(see [[#model-liveness]]).
49685010

5011+
<div class=exceptions>
5012+
5013+
: {{DOMException}} of type "{{NoModificationAllowedError}}"
5014+
::
5015+
Raised if any [=effect target=] is not an element
5016+
capable of having a [=style attribute=].
5017+
5018+
: {{DOMException}} of type "{{InvalidStateError}}"
5019+
::
5020+
Raised if any [=effect target=] is not [=being rendered=].
5021+
5022+
</div>
5023+
49695024
<wpt>
49705025
interfaces/Animation/commitStyles.html
49715026
</wpt>
@@ -5240,6 +5295,22 @@ The {{AnimationEffect}} interface {#the-animationeffect-interface}
52405295

52415296
</div>
52425297

5298+
<div class=exceptions>
5299+
5300+
: {{TypeError}}
5301+
::
5302+
Raised if any of the following conditions applies:
5303+
5304+
* {{EffectTiming/iterationStart}} is negative;
5305+
* {{EffectTiming/iterations}} is negative
5306+
or <code class=esvalue>NaN</code>;
5307+
* {{EffectTiming/duration}} is negative,
5308+
<code class=esvalue>NaN</code>,
5309+
or a string other than `auto`; or
5310+
* {{EffectTiming/easing}} cannot be parsed as an <<easing-function>>.
5311+
5312+
</div>
5313+
52435314
</div>
52445315

52455316
Issue(2082): The <code>remove()</code> method can be used to remove an effect
@@ -5960,6 +6031,18 @@ The {{KeyframeEffect}} interface {#the-keyframeeffect-interface}
59606031

59616032
</div>
59626033

6034+
<div class=exceptions>
6035+
6036+
: {{TypeError}}
6037+
::
6038+
Raised if an iterable yields a value other than `undefined`, `null`,
6039+
or an object;
6040+
if the keyframes are not [=loosely sorted by offset=];
6041+
if a non-null [=keyframe offset=] is outside the range [0, 1];
6042+
or if an easing cannot be parsed as an <<easing-function>>.
6043+
6044+
</div>
6045+
59636046
</div>
59646047

59656048
### Creating a new <code>KeyframeEffect</code> object ### {#creating-a-new-keyframeeffect-object}
@@ -6866,6 +6949,21 @@ The <code>Animatable</code> interface mixin {#the-animatable-interface-mixin}
68666949

68676950
</div>
68686951

6952+
<div class=exceptions>
6953+
6954+
: {{TypeError}}
6955+
::
6956+
Raised under the conditions described for
6957+
{{AnimationEffect/updateTiming()}} or
6958+
{{KeyframeEffect/setKeyframes()}}.
6959+
6960+
: {{DOMException}} of type "{{SyntaxError}}"
6961+
::
6962+
Raised if the {{KeyframeEffectOptions/pseudoElement}} option
6963+
is not `null` and is an invalid <<pseudo-element-selector>>.
6964+
6965+
</div>
6966+
68696967
: <dfn lt="getAnimations(options)">sequence&lt;Animation&gt; getAnimations(|options|)</dfn>
68706968
::
68716969
1. Let |object| be the object on which this method was called.
@@ -6906,6 +7004,15 @@ The <code>Animatable</code> interface mixin {#the-animatable-interface-mixin}
69067004

69077005
</div>
69087006

7007+
<div class=exceptions>
7008+
7009+
: {{DOMException}} of type "{{SyntaxError}}"
7010+
::
7011+
Raised if the {{GetAnimationsOptions/pseudoElement}} option
7012+
is not `null` and is an invalid <<pseudo-element-selector>>.
7013+
7014+
</div>
7015+
69097016
</div>
69107017

69117018
<div dfn-type=dict-member class=members>
@@ -7339,7 +7446,9 @@ Changes since last publication {#changes-since-last-publication}
73397446
The following changes have been made since the
73407447
<a href="https://www.w3.org/TR/2023/WD-web-animations-1-20230605/">5 June 2023 Working Draft</a>:
73417448

7342-
(Nothing yet)
7449+
* Added annotations describing exceptions thrown by methods
7450+
in the [[#programming-interface]].
7451+
(<a href="https://github.com/w3c/csswg-drafts/issues/2050">Issue 2050</a>)
73437452

73447453
The <a href="https://github.com/w3c/csswg-drafts/commits/main/web-animations-1">changelog</a>
73457454
provides a more detailed history.

0 commit comments

Comments
 (0)