[csswg-drafts] [css-selectors] Compare values across different attributes? (#11536)

benface has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-selectors] Compare values across different attributes? ==
I feel like this was probably already proposed before, but I couldn't find an existing issue. Apologies if I didn't search properly.

It would be nice to be able to select elements that have two attributes with the same value, or _not_ the same value, with something like:

```css
[data-attribute-1==data-attribute-2] {
  /* styles when [data-attribute-1] has the same value as [data-attribute-2] */
}

[data-attribute-1!==data-attribute-2] {
  /* styles when [data-attribute-1] does NOT have the same value as [data-attribute-2]...
     maybe not necessary because we can also just wrap the above in `:not()` */
}
```

For some reason I was under the impression that this use case would be unlocked with `attr()`, but `attr()` cannot be used in selectors (right?)

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11536 using your GitHub account


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

Received on Sunday, 19 January 2025 23:20:08 UTC