Re: [selectors4] Attribute selectors for numerical comparison

> 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