From 46bd325e2544e65cd0e809123716aad8dfd04078 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Wed, 18 Dec 2024 18:57:16 +0000 Subject: [PATCH 1/2] [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: https://github.com/w3c/csswg-drafts/issues/10995#issuecomment-2551949161 --- css-view-transitions-2/Overview.bs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs index ffd34167b872..a56b2041518e 100644 --- a/css-view-transitions-2/Overview.bs +++ b/css-view-transitions-2/Overview.bs @@ -791,13 +791,20 @@ li:nth-child(4) { view-transition-name: item1; } ... ``` -With ''view-transition-name/auto'', this CSS would work: +With ''view-transition-name/auto'' or ''view-transition-name/match-element'', this CSS would work: ```css li { view-transition-name: auto; + /* or */ + view-transition-name: match-element; } ``` + +The ''view-transition-name/auto'' and ''view-transition-name/match-element'' keywords have a minor +difference, where ''view-transition-name/auto'' would use the element's [=Element/id=] as the 'view-transition-name' +if exists, making it potentially work across documents, while ''view-transition-name/match-element'' only matches +based on element identity. ## Additions to 'view-transition-name' ## {#additions-to-vt-name} @@ -807,8 +814,8 @@ To resolve the [=used value=] of 'view-transition-name' for |element|: 1. Let |computed| be the [=computed value=] of 'view-transition-name'. 1. If |computed| is none, return null. 1. If |computed| is a <>, return |computed|. - 1. Assert: |computed| is auto. - 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=]. + 1. Assert: |computed| is auto or match-element. + 1. If |computed| is auto, |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=]. Note: this means that a ''::part()'' pseudo-element wouldn't resolve to its matching element's [=Element/id=]. From e52cd9378897f925ef90e5a4409fd858380307e5 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Wed, 18 Dec 2024 18:59:22 +0000 Subject: [PATCH 2/2] Add vt-1 restriction --- css-view-transitions-1/Overview.bs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/css-view-transitions-1/Overview.bs b/css-view-transitions-1/Overview.bs index 77486c7f750b..9a7267dac960 100644 --- a/css-view-transitions-1/Overview.bs +++ b/css-view-transitions-1/Overview.bs @@ -542,7 +542,7 @@ urlPrefix: https://wicg.github.io/navigation-api/; type: interface; Note: Since currently only document-scoped view transitions are supported, only view transition names that are associated with the document are respected. - The values none and auto are excluded from <> here. + The values none, auto, and match-element are excluded from <> here. Note: If this name is not unique (i.e. if two elements simultaneously specify the same [=view transition name=]) @@ -1994,6 +1994,7 @@ Changes from issue 10145. * Add a rendering characteristics note about out-of-viewport elements. See issue 8282. * Swap the order of invoking the update callback and setting the phase. See issue 10822. +* Disallow match-element as a custom-ident. See Issue 10995.

Changes from 2022-05-25 Working Draft