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

Re: [selectors4] Attribute selectors for numerical comparison

From: Lea Verou <lea@verou.me>
Date: Tue, 3 Nov 2015 09:42:37 -0800
Cc: www-style list <www-style@w3.org>
Message-Id: <889E460D-9B35-48B5-AA3F-73B5CF45B249@verou.me>
To: Rudolph Gottesheim <r.gottesheim@loot.at>

> On Nov 2, 2015, at 08:50, Rudolph Gottesheim <r.gottesheim@loot.at> wrote:
> 
> 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.

Yup. Just this deviates from any kind of number parsing on the Web Platform. Not sure if that’s a problem. It basically means everything can be parsed as a number as long as it has at least one digit.

~Lea
Received on Tuesday, 3 November 2015 17:43:08 UTC

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