W3C home > Mailing lists > Public > www-style@w3.org > November 2015

Re: [selectors4] Attribute selectors for numerical comparison

From: Rudolph Gottesheim <r.gottesheim@loot.at>
Date: Mon, 2 Nov 2015 17:50:05 +0100
To: www-style@w3.org
Message-ID: <5637943D.5010808@loot.at>
On 2015-11-02 15:07, Lea Verou wrote:
> 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.

I think there's a fourth option:

4. We try to convert all attribute values to numbers, for example 
data-date="2015-11-02" to 20151102 or data-date="2015-11" to 201511. 
Then the converted values could be compared as numbers.
Received on Monday, 2 November 2015 16:50:45 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:58 UTC