Skip to content

Commit cc56543

Browse files
authored
[css-view-transitions-1] Always perform all the update callbacks before capturing the new state. (#11693)
Closes #11292
1 parent efb1d21 commit cc56543

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

css-view-transitions-1/Overview.bs

+27-3
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,9 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
11581158
with [=this=]'s [=document element=] is its [=originating element=].
11591159

11601160
Note: The position of the [=ViewTransition/transition root pseudo-element=] within the [=document element=] does not matter, as the [=ViewTransition/transition root pseudo-element=]'s [=containing block=] is the [=snapshot containing block=].
1161+
1162+
: <dfn>update callback queue</dfn>
1163+
:: A [=/list=], initially empty.
11611164
</dl>
11621165

11631166
### Additions to Elements ### {#elements-concept}
@@ -1253,6 +1256,10 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
12531256

12541257
1. Let |document| be |transition|'s [=relevant global object's=] [=associated document=].
12551258

1259+
1. [=Flush the update callback queue=].
1260+
1261+
Note: this ensures that any changes to the DOM scheduled by other skipped transitions are done before the old state for this transition is captured.
1262+
12561263
1. [=Capture the old state=] for |transition|.
12571264

12581265
If failure is returned, then [=skip the view transition=] for |transition| with an "{{InvalidStateError}}" {{DOMException}} in |transition|'s [=relevant Realm=],
@@ -1271,7 +1278,9 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
12711278

12721279
Note: This happens if |transition| was [=skip the view transition|skipped=] before this point.
12731280

1274-
1. [=call the update callback=].
1281+
1. [=schedule the update callback=] for |transition|.
1282+
1283+
1. [=Flush the update callback queue=].
12751284
</div>
12761285

12771286
<div algorithm>
@@ -1649,6 +1658,20 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
16491658

16501659
</div>
16511660

1661+
<div algorithm>
1662+
To <dfn>schedule the update callback</dfn> given a {{ViewTransition}} |transition|:
1663+
1. [=list/Append=] |transition| to |transition|'s [=relevant settings object=]'s [=update callback queue=].
1664+
1. [=Queue a global task=] on the [=DOM manipulation task source=],
1665+
given |transition|'s [=relevant global object=], to [=flush the update callback queue=].
1666+
1667+
</div>
1668+
<div algorithm>
1669+
To <dfn>flush the update callback queue</dfn> given a {{Document}} |document|:
1670+
1. [=list/For each=] |transition| in |document|'s [=update callback queue=], [=call the update callback=] given |transition|.
1671+
1672+
1. Set |document|'s [=update callback queue=] to an empty list.
1673+
</div>
1674+
16521675
## [=Skip the view transition=] ## {#skip-the-view-transition-algorithm}
16531676

16541677
<div algorithm>
@@ -1658,8 +1681,8 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
16581681

16591682
1. [=Assert=]: |transition|'s [=ViewTransition/phase=] is not "`done`".
16601683

1661-
1. If |transition|'s [=ViewTransition/phase=] is before "`update-callback-called`", then [=queue a global task=] on the [=DOM manipulation task source=],
1662-
given |transition|'s [=relevant global object=], to [=call the update callback=] of |transition|.
1684+
1. If |transition|'s [=ViewTransition/phase=] is before "`update-callback-called`",
1685+
then [=schedule the update callback=] for |transition|.
16631686

16641687
1. Set [=document/rendering suppression for view transitions=] to false.
16651688

@@ -1994,6 +2017,7 @@ Changes from <a href="https://www.w3.org/TR/2023/WD-css-view-transitions-1-20230
19942017
* Fix scoping to match name instead of element. See <a href="https://github.com/w3c/csswg-drafts/issues/10145">issue 10145</a>.
19952018
* Add a rendering characteristics note about out-of-viewport elements. See <a href="https://github.com/w3c/csswg-drafts/issues/8282">issue 8282</a>.
19962019
* Swap the order of invoking the update callback and setting the phase. See <a href="https://github.com/w3c/csswg-drafts/issues/10822">issue 10822</a>.
2020+
* Always flush the queue of update callbacks before capturing the old state. See <a href="https://github.com/w3c/csswg-drafts/issues/11292">issue 11922</a>.
19972021

19982022
<h3 id="changes-since-2022-05-25">
19992023
Changes from <a href="https://www.w3.org/TR/2023/WD-css-view-transitions-1-20230525/">2022-05-25 Working Draft</a>

0 commit comments

Comments
 (0)