Skip to content

[css-view-transitions-1] Where are the "named elements" map cleaned up? #9669

Closed

Description

@nt1m

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.

@khushalsagar @noamr @vmpstr @fantasai @tabatkins

Activity

  1. nt1m commented on Dec 2, 2023

    @nt1m
    MemberAuthor

    Similarly I don't see where the pseudo element tree is being torn down in the algorithms.

  2. 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
  3. 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
  4. nt1m commented on Dec 2, 2023

    @nt1m
    MemberAuthor

    Nevermind for the pseudo element tree. "show view transition tree" covers it.

  5. 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
  6. noamr commented on Dec 2, 2023

    @noamr
    Collaborator

    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.

  7. nt1m commented on Dec 2, 2023

    @nt1m
    MemberAuthor

    @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)

  8. noamr commented on Dec 2, 2023

    @noamr
    Collaborator

    @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.

  9. nt1m commented on Dec 2, 2023

    @nt1m
    MemberAuthor

    Ah right, that makes sense thanks!

  10. added
    Closed as Question AnsweredUsed when the issue is more of a question than a problem, and it's been answered.
    on Dec 2, 2023
  11. nt1m commented on Dec 2, 2023

    @nt1m
    MemberAuthor

    I wonder if it makes sense to add a note if this is implicit.

  12. noamr commented on Dec 3, 2023

    @noamr
    Collaborator

    I wonder if it makes sense to add a note if this is implicit.

    It's explicit though:

    https://www.w3.org/TR/css-view-transitions-1/#viewtransition-named-elements

    "A {{ViewTransition}} has the following:"

  13. nt1m commented on Dec 3, 2023

    @nt1m
    MemberAuthor

    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.

  14. khushalsagar commented on Jan 5, 2024

    @khushalsagar
    Member

    Sounds reasonable @nt1m. Feel free to send a PR or let me know if you'd like me to do that. :)

  15. added a commit that references this issue on Jan 5, 2024
    6709892
  16. nt1m commented on Jan 5, 2024

    @nt1m
    MemberAuthor

    I sent a PR: #9769

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Closed as Question AnsweredUsed when the issue is more of a question than a problem, and it's been answered.css-view-transitions-1View Transitions; Bugs only

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions