You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[css-view-transitions-2] Apply resolutions for view-transition types (#10072)
* [css-view-transitions-2] Apply resolutions for view-transition types
- Make types mutable using ViewTransition.typeList
#9542 (comment)
- Separate `:active-view-transition` and `:active-view-transition-type`
See #9972 (comment)
- Add notes about types being bound to one document
See #9526 (comment)Closes#9972Closes#9542Closes#9526Closes#9626
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
---------
Co-authored-by: Khushal Sagar <63884798+khushalsagar@users.noreply.github.com>
Copy file name to clipboardExpand all lines: css-view-transitions-2/Overview.bs
+56-26Lines changed: 56 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -290,39 +290,51 @@ for multiple view transition pseudo elements without having to replicate the cor
290
290
291
291
# Pseudo-classes # {#pseudo-classes}
292
292
293
-
## Active View Transition Pseudo-class '':active-view-transition()''' ## {#the-active-view-transition-pseudo}
293
+
## Active View Transition Pseudo-class '':active-view-transition()'' ## {#the-active-view-transition-pseudo}
294
294
295
-
The <dfn id='active-view-transition-pseudo'>:active-view-transition(<<vt-type-selector>>)</dfn> pseudo-class applies to the root element of the document, if it has a matching[=active view transition=].
295
+
The <dfn id='active-view-transition-pseudo'>:active-view-transition</dfn> pseudo-class applies to the root element of the document, if it has an[=active view transition=].
The [=specificity=] of an '':active-view-transition()'' is one pseudo-class selector if it has value is ''*'', and two if it has any other value.
302
+
The [=specificity=] of an '':active-view-transition'' is one pseudo-class selector.
304
303
305
-
An '':active-view-transition()'' pseudo-class matches the [=document element=] when it has an non-null [=active view transition=] |viewTransition|, for which any of the following are true:
304
+
An '':active-view-transition'' pseudo-class matches the [=document element=] when its [=node document=]has an non-null [=active view transition=].
306
305
307
-
* The <<vt-type-selector>> is ''*''
308
-
* |viewTransition|'s [=ViewTransition/active types=][=list/contains=] at least one of the <<custom-ident>> values of the <<vt-type-selector>>.
306
+
## Active View Transition Type Pseudo-class '':active-view-transition-type()'' ## {#the-active-view-transition-type-pseudo}
307
+
308
+
The <dfn id='active-view-transition-type-pseudo'>:active-view-transition-type()</dfn> pseudo-class applies to the root element of the document, if it has a matching [=active view transition=].
309
+
It has the following syntax definition:
310
+
311
+
<pre class=prod>
312
+
:active-view-transition-type(<<custom-ident>>#)
313
+
</pre>
314
+
315
+
The [=specificity=] of an '':active-view-transition-type()'' is two pseudo-class selectors.
316
+
317
+
An '':active-view-transition-type()'' pseudo-class matches the [=document element=] when its [=node document=] has an non-null [=active view transition=],
318
+
whose [=ViewTransition/active types=][=list/contains=] at least one of the <<custom-ident>> arguments.
@@ -435,6 +447,9 @@ Note: as per default behavior, the ''@view-transition'' rule can be nested insid
435
447
The '<dfn for="@view-transition">type</dfn>' descriptor sets the [=ViewTransition/active types=] for the transition
436
448
when capturing and performing the transition, equivalent to calling {{Document/startViewTransition(callbackOptions)}} with that {{StartViewTransitionOptions/type}}.
437
449
450
+
Note: the [=@view-transition/type=] descriptor only applies to the {{Document}} in which it is defined.
451
+
The author is responsible for using their chosen set of types in both documents.
452
+
438
453
# API # {#api}
439
454
440
455
## Additions to {{Document}} ## {#additions-to-document-api}
@@ -473,7 +488,7 @@ Note: as per default behavior, the ''@view-transition'' rule can be nested insid
473
488
474
489
1. Let |viewTransition| be the result of running the [=method steps=] for {{Document/startViewTransition(updateCallback)}} given |updateCallback|.
475
490
476
-
1. If |callbackOptions| is a {{StartViewTransitionOptions}}, then set |viewTransition|'s [=ViewTransition/active types=]to |callbackOptions|'s {{StartViewTransitionOptions/type}}.
491
+
1. If |callbackOptions| is a {{StartViewTransitionOptions}}, set |viewTransition|'s [=ViewTransition/active types=]'s [=DOMTokenList/token set=]to a [=list/clone=] of {{StartViewTransitionOptions/type}} as a [=/set=].
477
492
478
493
1. Return |viewTransition|.
479
494
</div>
@@ -529,13 +544,23 @@ The {{CSSViewTransitionRule}} represents a ''@view-transition'' rule.
529
544
530
545
### Additions to {{ViewTransition}} ### {#view-transitions-extension}
531
546
547
+
The {{ViewTransition}} interface is extended as follows:
548
+
549
+
<pre class='idl'>
550
+
partial interface ViewTransition {
551
+
readonly attribute DOMTokenList typeList;
552
+
};
553
+
</pre>
554
+
555
+
The {{ViewTransition/typeList}}[=getter steps=] are to return [=this=]'s [=ViewTransition/active types=].
556
+
532
557
A {{ViewTransition}} additionally has:
533
558
<dl dfn-for=ViewTransition>
534
559
: <dfn>outbound post-capture steps</dfn>
535
560
:: Null or a set of steps, initially null.
536
561
537
562
: <dfn>active types</dfn>
538
-
:: Null or a [=list=] of strings, initially null.
563
+
:: A {{DOMTokenList}}, initially a new {{DOMTokenList}}.
539
564
</dl>
540
565
541
566
### Additions to [=captured element=] struct ### {#additions-to-captured-element-struct}
@@ -626,9 +651,9 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
626
651
627
652
1. Let |typesDescriptor| be |matchingRule|'s [=@view-transition/type=] descriptor.
628
653
629
-
1. If |typesDescriptor|'s [=computed value=] is ''@view-transition/type/none'', then return a [=/list=] « ».
654
+
1. If |typesDescriptor|'s [=computed value=] is ''@view-transition/type/none'', then return a [=/set=] « ».
630
655
631
-
1. Return a [=list=] of strings corresponding to |typesDescriptor|'s [=computed value=].
656
+
1. Return a [=/set=] of strings corresponding to |typesDescriptor|'s [=computed value=].
632
657
</div>
633
658
634
659
### Setting up the view-transition in the old {{Document}} ### {#setup-old-document-vt}
@@ -674,8 +699,13 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
674
699
Note: this means that any running transition would be skipped when the document is ready
675
700
to unload.
676
701
677
-
1. Let |outboundTransition| be a new {{ViewTransition}} object in |oldDocument|'s [=relevant Realm=],
678
-
whose [=ViewTransition/active types=] is |resolvedRule|.
702
+
1. Let |outboundTransition| be a new {{ViewTransition}} object in |oldDocument|'s [=relevant Realm=].
703
+
704
+
1. Set |outboundTransition|'s [=ViewTransition/active types=]'s [=DOMTokenList/token set=] to |resolvedRule|.
705
+
706
+
Note: the [=ViewTransition/active types=] are not shared between documents.
707
+
Manipulating the {{ViewTransition/typeList}} in the new document does not affect the types in the new document,
708
+
which would be read from the [=@view-transition/type=] descriptor once the document is revealed.
679
709
680
710
Note: the {{ViewTransition}} is skipped once the old document is hidden.
681
711
@@ -730,7 +760,7 @@ Prepend this to the [=Perform pending transition operations=] algorithm given a
730
760
731
761
1. Set |transition|’s [=ViewTransition/phase=] to "`update-callback-called`".
732
762
733
-
1. Set |transition|'s [=ViewTransition/active types=] to |resolvedRule|.
763
+
1. Set |transition|'s [=ViewTransition/active types=]'s [=DOMTokenList/token set=] to |resolvedRule|.
734
764
735
765
1. At any given time, the UA may decide to skip the inbound transition, e.g. after an [=implementation-defined=] timeout.
736
766
To do so, the UA should [=queue a global task=] on the [=DOM manipulation task source=] given |document|'s [=relevant global object=] to perform the following step:
0 commit comments