Re: [csswg-drafts] [css-view-transitions-2] view-transition-name determined by element (#8320)

> ([#](https://github.com/w3c/csswg-drafts/issues/8320#issuecomment-1877522852)) I wonder what people think about an idea like this:
> 
> `section.list li.item[:id] img { view-transition-name: item-[:id] }`
> 
> Where the attributes are captured in the selector chain and then used to generate a name.

Interesting. I like how this allows you to capture an attribute from a parent element and use that on a child. With `attr()` that’s not immediately possible, unless you jump through some hoops using a custom property.

Two thoughts:

- I would use something different than `:` to capture it, as it could be confused with pseudos. Am thinking of an `@` right now:

    ```css
    section.list li.item[@id] { … }
    ```
- To use it in an ident, I think we’d still need somethink like #9141 to dynamically construct the resulting ident.

    ```css
    section.list li.item[@id] {
        view-transition-name: ident("item-" @id);
    }
    ```
    
    _(Am using `@id` to refer to the local variable here)_

-- 
GitHub Notification of comment by bramus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8320#issuecomment-1878422356 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 5 January 2024 10:08:13 UTC