Skip to content

Commit 8889771

Browse files
committed
Structure class algos as additional steps
1 parent d918977 commit 8889771

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

‎css-view-transitions-1/Overview.bs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,8 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
12251225
Note: These are used to update, and later remove styles
12261226
from a [=/document=]'s [=document/dynamic view transition style sheet=].
12271227

1228+
Other specs can supply <dfn>additional capture steps</dfn>, which is an algorithm that acepts a [=captured element=] and an [=element=].
1229+
12281230
## [=Perform pending transition operations=] ## {#perform-pending-transition-operations-algorithm}
12291231

12301232
<div algorithm>
@@ -1398,6 +1400,8 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
13981400

13991401
1. Set |namedElements|[|transitionName|] to |capture|.
14001402

1403+
1. Perform [=additional capture steps=] given |capture| and |element|.
1404+
14011405
1. [=list/For each=] |element| in |captureElements|:
14021406

14031407
1. Set |element|'s [=captured in a view transition=] to false.
@@ -1439,6 +1443,8 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
14391443
This might not be the right layering for all cases. See <a href="https://github.com/w3c/csswg-drafts/issues/8941">issue 8941</a>.
14401444

14411445
1. Set |namedElements|[|transitionName|]'s [=new element=] to |element|.
1446+
1447+
1. Perform [=additional capture steps=] given |namedElements|[|transitionName|] and |element|.
14421448
</div>
14431449

14441450
### [=Setup transition pseudo-elements=] ### {#setup-transition-pseudo-elements-algorithm}

‎css-view-transitions-2/Overview.bs‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ spec:css-view-transitions-1;
3232
text: call the update callback; type: dfn;
3333
text: perform pending transition operations; type: dfn;
3434
text: setup view transition; type: dfn;
35+
text: additional capture steps; type: dfn;
36+
text: named view transition pseudo-element; type: dfn;
3537
spec:dom; type:dfn; text:document
3638
spec:css22; type:dfn; text:element
3739
spec:selectors-4; type:dfn;
@@ -125,6 +127,8 @@ spec:infra; type:dfn; text:list
125127

126128
## Examples ## {#examples}
127129

130+
### Cross-document view-transitions ### {#cross-doc-example}
131+
128132
<div class=example>
129133
To generate the same cross-fade as in the first example [[css-view-transitions-1#examples]],
130134
but across documents, we don't need JavaScript.
@@ -259,20 +263,21 @@ for multiple elements without having to replicate the corresponding pseudo-eleme
259263
Animation type: discrete
260264
</pre>
261265

262-
The 'view-transition-class' works alongside 'view-transition-name', and is read at the same time
263-
'view-transition-name' is read. But unlike 'view-transition-name', 'view-transition-class' doesn't
264-
have to be unique - an element can have several view-transition classes, and the same 'view-transition-class'
265-
can apply to multiple elements. While 'view-transition-name' is used to match between the element
266-
in the old state with its corresponding element in the new state, 'view-transition-class' is used
266+
The 'view-transition-class' can be used to apply the same style rule to multiple [=named view transition pseudo-elements=] which may have a different 'view-transition-name'.
267+
While 'view-transition-name' is used to match between the element in the old state with its corresponding element in the new state, 'view-transition-class' is used
267268
only to apply styles using the view-transition pseudo-elements
268269
(''::view-transition-group()'', ''::view-transition-image-pair()'', ''::view-transition-old()'', ''::view-transition-new()'').
269270

271+
Note that 'view-transition-class' by itself doesn't mark an element for capturing, it is only used as an additional
272+
way to style an element that already has a 'view-transition-name'.
273+
270274
<dl dfn-type=value dfn-for=view-transition-class>
271275
: <dfn>none</dfn>
272-
:: No class would apply to the [=named view-transition pseudo-elements=] generated for this element.
276+
:: No class would apply to the [=named view transition pseudo-elements=] generated for this element.
273277

274278
: <dfn><<custom-ident>>*</dfn>
275-
:: All of the specified <<custom-ident>> values (apart from <css>none</css>) apply as classes for the [=/element=].
279+
:: All of the specified <<custom-ident>> values (apart from <css>none</css>) are applied when used in [=named view transition pseudo-element=] selectors.
280+
<css>none</css> is an invalid <<custom-ident>> for 'view-transition-class', even when combined with other <<custom-ident>>s.
276281

277282
Note: If the same 'view-transition-name' is specified for an element both in the old and new states of the transition,
278283
only the 'view-transition-class' values from the new state apply. This also applies for cross-document view-transitions:
@@ -332,11 +337,11 @@ document.startViewTransition({update: updateTheDOMSomehow});
332337
```
333338
</div>
334339

335-
# Additions to view-transition pseudo-elements # {#pseudo-element-additions}
340+
# Additions to named view-transition pseudo-elements # {#pseudo-element-additions}
336341

337-
The <dfn>named view transition pseudo-elements</dfn>
342+
The [=named view transition pseudo-elements=]
338343
(''view-transition-group()'', ''view-transition-image-pair()'', ''view-transition-old()'', ''view-transition-new()'')
339-
are extended to support the following syntax for each |pseudo|:
344+
are extended to support the following syntax:
340345

341346
<pre class=prod>
342347
::view-transition-group(<<pt-name-selector>><<pt-class-selector>>)
@@ -353,8 +358,8 @@ document.startViewTransition({update: updateTheDOMSomehow});
353358
</pre>
354359

355360
A [=named view transition pseudo-element=] [=selector=] which has one or more <<custom-ident>> values
356-
in its <<pt-class-selector>> would only match an element if the element's [=captured element/class list=]
357-
[=list/contains=] all of those values.
361+
in its <<pt-class-selector>> would only match an element if the [=captured element/class list=] value in
362+
[=ViewTransition/named elements=] for the pseudo-element's 'view-transition-name' [=list/contains=] all of those values.
358363

359364
The specificity of a [=named view transition pseudo-element=] [=selector=]
360365
with a <<pt-class-selector>>
@@ -495,23 +500,18 @@ The {{CSSViewTransitionRule}} represents a ''@view-transition'' rule.
495500

496501
## Additions to [=captured element=] struct ## {#additions-to-captured-element-struct}
497502

503+
The [=captured element=] struct should contain these fields, in addition to the existing ones:
504+
498505
<dl>
499506
: <dfn for="captured element">class list</dfn>
500507
:: a [=/list=] of strings, initially empty.
501508
</dl>
502509

503-
## Additions to capture algorithms: ## {#additions-to-capture-algorithms}
504-
<div algorithm="capture old classes">
505-
When capturing the old state of the view transition, perform the following step when iterating on |captureElements| given |element| and |capture|:
510+
## Algorithms to capture 'view-transition-class': ## {#vt-class-algorithms}
511+
<div algorithm="additional capture steps">
512+
This spec provides the following [=additional capture steps=] given a [=captured element=] |capture| and an [=element=] |element|:
506513

507514
1. Set |capture|'s [=captured element/class list=] to the [=computed value=] of |element|'s 'view-transition-class'.
508-
509-
</div>
510-
511-
<div algorithm="capture new classes">
512-
When capturing the new state of the view transition, perform the following step when iterating on |captureElements| given |element| and |namedElements|:
513-
514-
1. Set |namedElement|[|transitionName|]'s [=captured element/class list=] to the [=computed value=] of |element|'s 'view-transition-class'.
515515
</div>
516516

517517
## Monkey patches to HTML ## {#monkey-patch-to-html}

0 commit comments

Comments
 (0)