- From: Lea Verou <lea@verou.me>
- Date: Mon, 2 Nov 2015 06:07:38 -0800
- To: www-style list <www-style@w3.org>
- Message-Id: <0860D31D-C120-4A73-9574-744216FB1820@verou.me>
It seems that the need for greater-than and less-than operators in attribute selectors (i.e. [attr>value]) is very common, yet we only have equality and partial string matching. I imagine this is because every attribute is a string, but I don’t understand why we can’t define the selector to convert the attribute value to a <number> first, using the same grammar as CSS. If the conversion fails, the selector doesn’t match anything (this is on par with how comparisons work in JS too). The main wart with this is that what authors need is not always numerical comparison, but sometimes they need to compare e.g. dates [1]. There are multiple ways to deal with this: 1. We ignore it and just deal with numbers, since that already solves several use cases. We can always use different comparison attribute selectors in the future for dates. 2. We use heuristics to determine whether it's a date or a number. Can’t think of any conflict, but it's a bit hacky. 3. We use a whitelist, which could be different per host language. [1]: https://lists.w3.org/Archives/Public/www-style/2007Jan/0080.html <https://lists.w3.org/Archives/Public/www-style/2007Jan/0080.html> Lea Verou ✿ http://lea.verou.me ✿ @leaverou
Received on Monday, 2 November 2015 14:08:11 UTC