W3C home > Mailing lists > Public > public-css-archive@w3.org > January 2021

[csswg-drafts] [css-selectors] add numeric comparisons on attribute values (#5890)

From: Liam Quin via GitHub <sysbot+gh@w3.org>
Date: Mon, 25 Jan 2021 00:56:57 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-792947206-1611536216-sysbot+gh@w3.org>
liamquin has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-selectors] add numeric comparisons on attribute values ==
Can we have numeric comparisons?

e.g.
[data-balance<0] { color: red; } (common in accounting/finance, along with putting ( ) around the value)
[data-eyes>7.9] { color: black; background-colour: yellow } /* spider! */

with < <= >  >=

Noting that testing for equality is string equality so testing 06=6 fails, an alternative design might be to calc() to fetch an attribute value, and to be allowed in selectors, but that's more complex.

Maybe a new section inhttps://drafts.csswg.org/selectors/#attribute-selectors for Numeric Attribute Values?

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 25 January 2021 00:57:00 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:38 UTC