Skip to content

Commit 78dc281

Browse files
committed
[web-animations-1] Specify requirements on style change events
This fixes w3c#3613.
1 parent 20f4d1f commit 78dc281

File tree

1 file changed

+57
-6
lines changed

1 file changed

+57
-6
lines changed

web-animations-1/Overview.bs

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ urlPrefix: https://drafts.csswg.org/cssom/; type: dfn; spec: cssom
176176
text: serialize a CSS value
177177
urlPrefix: https://drafts.csswg.org/css-transitions/; type: dfn; spec: css-transitions-1
178178
text: events from CSS transitions; url: transition-events
179+
text: transitionend
179180
urlPrefix: https://drafts.csswg.org/css-animations/; type: dfn; spec: css-animations-1
180181
text: events from CSS animations; url: events
181182
urlPrefix: https://drafts.csswg.org/css-writing-modes-4/; type: dfn; spec: css-writing-modes-4
@@ -5458,9 +5459,11 @@ animation.play();</pre>
54585459
The returned list is sorted using the composite order described
54595460
for the associated <a>animations</a> of effects in [[#the-effect-stack]].
54605461

5461-
The returned list reflects the state <em>after</em> applying any pending
5462-
changes to animation such as changes to animation-related style properties
5463-
that have yet to be processed.
5462+
Calling this method triggers a [=style change event=] for the <a>target
5463+
element</a>.
5464+
As a result, the returned list reflects the state <em>after</em> applying
5465+
any pending style changes to animation such as changes to animation-related
5466+
style properties that have yet to be processed.
54645467

54655468
</div>
54665469

@@ -5504,9 +5507,10 @@ partial interface Document {
55045507
The returned list is sorted using the composite order described
55055508
for the associated <a>animations</a> of effects in [[#the-effect-stack]].
55065509

5507-
The returned list reflects the state <em>after</em> applying any pending
5508-
changes to animation such as changes to animation-related style properties
5509-
that have yet to be processed.
5510+
Calling this method triggers a [=style change event=] for the document.
5511+
As a result, the returned list reflects the state <em>after</em> applying
5512+
any pending style changes to animation such as changes to animation-related
5513+
style properties that have yet to be processed.
55105514

55115515
Issue(2054): Both this method and {{Animatable/getAnimations()}} on the
55125516
{{Animatable}} interface mixin require retaining
@@ -5605,6 +5609,20 @@ dictionary AnimationPlaybackEventInit : EventInit {
56055609
Changes made to any part of the model, cause the entire timing model to be
56065610
updated and any dependent style.
56075611

5612+
Unless otherwise stated,
5613+
invoking the methods or constructors,
5614+
or getting or setting the members
5615+
of interfaces defined in the programming interface section of this specification
5616+
does <em>not</em> produce a [=style change event=].
5617+
5618+
Note: Other specifications that extend this specification are expected to refine
5619+
the requirements on [=style change events=] by introducing circumstances where
5620+
such events <em>are</em> triggered.
5621+
For example,
5622+
when the interfaces in this specification represent
5623+
animations defined by CSS markup,
5624+
many of their methods will need to trigger [=style change events=]
5625+
in order to reflect changes to the specified style.
56085626

56095627
<div class="informative-bg"><em>This section is non-normative</em>
56105628

@@ -5703,6 +5721,39 @@ window.requestAnimationFrame(function(now) {
57035721
});</pre>
57045722
</div>
57055723

5724+
: Calling methods from this programming interface will generally
5725+
<em>not</em> cause transitions to be triggered
5726+
5727+
:: Consider the following example:
5728+
5729+
<div class="example">
5730+
<pre class="lang-javascript">
5731+
// Setup transition start point
5732+
div.style.opacity = '1';
5733+
getComputedStyle(div).opacity;
5734+
5735+
// Setup transition end point
5736+
div.style.transition = 'opacity 1s';
5737+
div.style.opacity = '0';
5738+
5739+
// Fire an animation
5740+
div.animate({ opacity: [0.5, 1] }, 500);
5741+
5742+
// Wait for the transition to end -- the following will never be called!
5743+
div.addEventListener('transitionend', () => {
5744+
console.log('transitionend');
5745+
});</pre>
5746+
</div>
5747+
5748+
In this case, calling {{Animatable/animate()}} will
5749+
<em>not</em> trigger a [=style change event=].
5750+
As a result, the pending style change will be processed at the same time
5751+
as the style change resulting from the new animation.
5752+
Since the animation style will override
5753+
the [=before-change style=] and the [=after-change style=],
5754+
no transition will be generated and
5755+
the event handler for the [=transitionend=] event will never be called.
5756+
57065757
</div>
57075758

57085759

0 commit comments

Comments
 (0)