Re: [csswg-drafts] [css-values-5] toggle() should be a pseudo-class akin to :nth-child() (#9899)

So I guess you say `toggle()` would be redundant because e.g.

```css
.list {
  list-style-type: toggle(disc, circle, "+ ", "> ", "* ");
}
```

could be expressed as

```css
:nth-descendant(6n+1 of .list) { list-style-type: disc }
:nth-descendant(6n+2 of .list) { list-style-type: circle }
:nth-descendant(6n+3 of .list) { list-style-type: "+ " }
:nth-descendant(6n+4 of .list) { list-style-type: "> " }
:nth-descendant(6n+5 of .list) { list-style-type: "* " }
```

But note that `toggle()` resolves depending on the inherited value, and the cascade is based on the flat tree. Presumably, `:nth-descendant()` wouldn't use the flat tree. This was one of the reasons to not deprecate `:focus-within` in #8357.

This is not to say that `toggle()` can't be dropped, but I think it may be better to consider your feature by itself, and if accepted, discuss if `toggle()` is still useful or not afterwards.


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


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

Received on Monday, 5 February 2024 12:44:23 UTC