Re: [selectors4] Attribute selectors for numerical comparison

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