Skip to content

Commit ca17ac4

Browse files
noamrbramus
andauthored
[css-view-transitions-1][css-view-transitions-2] Add view-transition-name: match-element (#11393)
* [css-view-transitions-1][css-view-transitions-2] Add view-transition-name: match-element match-element works the same as auto, except doesn't try to use the ID as the name. Resolution: #10995 (comment) * Add vt-1 restriction * Update css-view-transitions-2/Overview.bs Co-authored-by: Bramus <[email protected]> --------- Co-authored-by: Bramus <[email protected]>
1 parent 29b1f61 commit ca17ac4

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

css-view-transitions-1/Overview.bs

+2-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface;
542542

543543
Note: Since currently only document-scoped view transitions are supported, only view transition names that are associated with the document are respected.
544544

545-
The values <css>none</css> and <css>auto</css> are excluded from <<custom-ident>> here.
545+
The values <css>none</css>, <css>auto</css>, and <css>match-element</css> are excluded from <<custom-ident>> here.
546546

547547
Note: If this name is not unique
548548
(i.e. if two elements simultaneously specify the same [=view transition name=])
@@ -2018,6 +2018,7 @@ Changes from <a href="https://www.w3.org/TR/2023/WD-css-view-transitions-1-20230
20182018
* Add a rendering characteristics note about out-of-viewport elements. See <a href="https://github.com/w3c/csswg-drafts/issues/8282">issue 8282</a>.
20192019
* 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>.
20202020
* 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>.
2021+
* Disallow <css>match-element</css> as a custom-ident. See <a href="https://github.com/w3c/csswg-drafts/issues/10995">Issue 10995</a>.
20212022

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

css-view-transitions-2/Overview.bs

+10-3
Original file line numberDiff line numberDiff line change
@@ -791,13 +791,20 @@ li:nth-child(4) { view-transition-name: item1; }
791791
...
792792
```
793793

794-
With ''view-transition-name/auto'', this CSS would work:
794+
With ''view-transition-name/auto'' or ''view-transition-name/match-element'', this CSS would work:
795795

796796
```css
797797
li {
798798
view-transition-name: auto;
799+
/* or */
800+
view-transition-name: match-element;
799801
}
800802
```
803+
804+
The ''view-transition-name/auto'' and ''view-transition-name/match-element'' keywords have a minor
805+
difference, where ''view-transition-name/auto'' would use the element's [=Element/id=] as the 'view-transition-name'
806+
if it exists, making it potentially work across documents, while ''view-transition-name/match-element'' only matches
807+
based on element identity.
801808
</div>
802809

803810
## Additions to 'view-transition-name' ## {#additions-to-vt-name}
@@ -807,8 +814,8 @@ To resolve the [=used value=] of 'view-transition-name' for |element|:
807814
1. Let |computed| be the [=computed value=] of 'view-transition-name'.
808815
1. If |computed| is <css>none</css>, return null.
809816
1. If |computed| is a <<custom-ident>>, return |computed|.
810-
1. Assert: |computed| is <css>auto</css>.
811-
1. If |element| has an associated [=Element/id=], and |computed| is associated with the same [=tree/root=] as |element|'s [=tree/root=], then return the value of |element|'s [=Element/id=].
817+
1. Assert: |computed| is <css>auto</css> or <css>match-element</css>.
818+
1. If |computed| is <css>auto</css>, |element| has an associated [=Element/id=], and |computed| is associated with the same [=tree/root=] as |element|'s [=tree/root=], then return the value of |element|'s [=Element/id=].
812819

813820
Note: this means that a ''::part()'' pseudo-element wouldn't resolve to its matching element's [=Element/id=].
814821

0 commit comments

Comments
 (0)