Skip to content

Commit

Permalink
Wrap "activate view transition" with script prepare/clean up
Browse files Browse the repository at this point in the history
This ensures that we perform a microtask checkpoint (and set the incumbent script) right after resolving/rejecting the ViewTransition promises.

It's necessary as those promises need to be resolved before the other rendering operations, mainly style/layout.
  • Loading branch information
noamr authored Jul 12, 2024
1 parent 27059bd commit f2c7875
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -103105,8 +103105,21 @@ location.href = '#foo';</code></pre>
data-x="dom-PageRevealEvent-viewTransition">viewTransition</code> set to
<var>transition</var>.</p></li>

<li><p>If <var>transition</var> is not null, then <span
data-x="activate view transition">activate</span> <var>transition</var>.</p></li>
<li>
<p>If <var>transition</var> is not null, then:</p>

<ol>
<li><p><span>Prepare to run script</span> given <var>document</var>.</p></li>

<li><p><span data-x="activate view transition">Activate</span> <var>transition</var>.</p></li>

<li><p><span>Clean up after running script</span> given <var>document</var>.</p></li>
</ol>

<p class="note">Activating a view transition might resolve/reject promises, so by wrapping the
activation with prepare/cleanup we ensure those promises are handled before the next rendering
step.</p>
</li>
</ol>

<p class="note">Though <code data-x="event-pagereveal">pagereveal</code> is guaranteed to be fired
Expand Down

0 comments on commit f2c7875

Please sign in to comment.