Re: [csswg-drafts] [css-view-transitions-1] Disallow the name `auto` as `view-transition-name` (#9639)

> ([#](https://github.com/w3c/csswg-drafts/issues/9639#issuecomment-1877359370)) Sounds effectively like `attr()`.

Key difference here is that you’re able to capture an attribute from a parent element and use it in a child element. With `attr()` you’d need to store the `[id]` of the `li` into a variable to pass it onto the child `img` element.

```css
/* Proposal by noamr */
section.list li.item[:id] img {
  view-transition-name: item-[:id];
}

/* Reworked using attr() and ident() from https://github.com/w3c/csswg-drafts/issues/9141 */
section.list li.item[id] {
  --id: attr(id);

  img {
    view-transition-name: ident("item-" var(--id));
  }
}
```

-- 
GitHub Notification of comment by bramus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9639#issuecomment-1878410097 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:00:24 UTC