From 86be2ba167a9b7a5adb6d4a51319ff0441fbb572 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Wed, 18 Dec 2024 18:57:16 +0000 Subject: [PATCH 1/3] [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 adb4f680268a..21b3fab8e81d 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 f759cd956a82e5e47f1669822a063b6b367236d1 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Wed, 18 Dec 2024 18:59:22 +0000 Subject: [PATCH 2/3] 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 6b6922527adb..f7b18377808e 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=]) @@ -2018,6 +2018,7 @@ Changes from issue 8282. * Swap the order of invoking the update callback and setting the phase. See issue 10822. * Always flush the queue of update callbacks before capturing the old state. See issue 11922. +* Disallow match-element as a custom-ident. See Issue 10995.

Changes from 2022-05-25 Working Draft From 814cb3d1e65c81111807fa5c0d62487229dee758 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Thu, 20 Feb 2025 11:12:09 +0000 Subject: [PATCH 3/3] Update css-view-transitions-2/Overview.bs Co-authored-by: Bramus --- css-view-transitions-2/Overview.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css-view-transitions-2/Overview.bs b/css-view-transitions-2/Overview.bs index 21b3fab8e81d..0a9ded2e92bf 100644 --- a/css-view-transitions-2/Overview.bs +++ b/css-view-transitions-2/Overview.bs @@ -803,7 +803,7 @@ li { 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 +if it exists, making it potentially work across documents, while ''view-transition-name/match-element'' only matches based on element identity.