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
{{ message }}
Repository navigation
[css-view-transitions-1] Where are the "named elements" map cleaned up? #9669
I noticed while reading the spec that the "named elements" map is never cleaned up, so it might become stale with elements that no longer have a view-transition-name. But it's also possible that I missed something here.
changed the title [-][css-view-transitions-1] Where is the "named elements" map cleaned up?[/-][+][css-view-transitions-1] Where is the "named elements" map and pseudo elements cleaned up?[/+]on Dec 2, 2023
changed the title [-][css-view-transitions-1] Where is the "named elements" map and pseudo elements cleaned up?[/-][+][css-view-transitions-1] Where are the "named elements" map and pseudo elements cleaned up?[/+]on Dec 2, 2023
changed the title [-][css-view-transitions-1] Where are the "named elements" map and pseudo elements cleaned up?[/-][+][css-view-transitions-1] Where are the "named elements" map cleaned up?[/+]on Dec 2, 2023
What would be the observable effect of specifying this? the map gets populated twice and is no longer in use after setting the pseudo elements style, but I don't know what it would mean that it holds stale elements after this.
If you change view transition names after capturing the new state it's too late for this view transition as everything is already captured.
@noamr The named elements map is used as input to build the pseudo element tree, so it's rather important that cleanup is specified. Otherwise, implementing as it is means that the pseudo element tree will be built with non-existent groups if you do the following steps:
start a view transition with A & B having view-transition-names
wait for it to end
set view-transition-name: none on B
start another view-transition
-> B gets constructed along with A (even though B has view-transition-name: none)
@noamr The named elements map is used as input to build the pseudo element tree, so it's rather important that cleanup is specified. Otherwise, implementing as it is means that the pseudo element tree will be built with non-existent groups if you do the following steps:
start a view transition with A & B having view-transition-names
wait for it to end
set view-transition-name: none on B
start another view-transition
-> B gets constructed along with A (even though B has view-transition-name: none)
Oh I see. The named element map is associated with a particular ViewTransition object, so starting a new one would ignore any existing one from a previous transition.
That part is explicit, but I think it would be useful to mention a note about clean up: "Note: Since this is associated to the ViewTransition, this means the map is cleaned up along with the view transition when that ends" or something. Because naturally when you're looking to implement this, you're looking for where things are getting cleaned up.
Activity
nt1m commentedon Dec 2, 2023
Similarly I don't see where the pseudo element tree is being torn down in the algorithms.
[-][css-view-transitions-1] Where is the "named elements" map cleaned up?[/-][+][css-view-transitions-1] Where is the "named elements" map and pseudo elements cleaned up?[/+][-][css-view-transitions-1] Where is the "named elements" map and pseudo elements cleaned up?[/-][+][css-view-transitions-1] Where are the "named elements" map and pseudo elements cleaned up?[/+]nt1m commentedon Dec 2, 2023
Nevermind for the pseudo element tree. "show view transition tree" covers it.
[-][css-view-transitions-1] Where are the "named elements" map and pseudo elements cleaned up?[/-][+][css-view-transitions-1] Where are the "named elements" map cleaned up?[/+]noamr commentedon Dec 2, 2023
What would be the observable effect of specifying this? the map gets populated twice and is no longer in use after setting the pseudo elements style, but I don't know what it would mean that it holds stale elements after this.
If you change view transition names after capturing the new state it's too late for this view transition as everything is already captured.
nt1m commentedon Dec 2, 2023
@noamr The named elements map is used as input to build the pseudo element tree, so it's rather important that cleanup is specified. Otherwise, implementing as it is means that the pseudo element tree will be built with non-existent groups if you do the following steps:
view-transition-name: noneon B-> B gets constructed along with A (even though B has
view-transition-name: none)noamr commentedon Dec 2, 2023
Oh I see. The named element map is associated with a particular ViewTransition object, so starting a new one would ignore any existing one from a previous transition.
nt1m commentedon Dec 2, 2023
Ah right, that makes sense thanks!
nt1m commentedon Dec 2, 2023
I wonder if it makes sense to add a note if this is implicit.
noamr commentedon Dec 3, 2023
It's explicit though:
https://www.w3.org/TR/css-view-transitions-1/#viewtransition-named-elements
"A {{ViewTransition}} has the following:"
nt1m commentedon Dec 3, 2023
That part is explicit, but I think it would be useful to mention a note about clean up: "Note: Since this is associated to the ViewTransition, this means the map is cleaned up along with the view transition when that ends" or something. Because naturally when you're looking to implement this, you're looking for where things are getting cleaned up.
khushalsagar commentedon Jan 5, 2024
Sounds reasonable @nt1m. Feel free to send a PR or let me know if you'd like me to do that. :)
[css-view-transitions-1] Add a note to explain how the named elements…
nt1m commentedon Jan 5, 2024
I sent a PR: #9769