Skip to content

Commit 86be2ba

Browse files
committed
[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)
1 parent 29b1f61 commit 86be2ba

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

css-view-transitions-2/Overview.bs

Lines changed: 10 additions & 3 deletions
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 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)