Re: [selectors4] Specificity in base 256

Le 17/08/2012 15:32, Aryeh Gregor a écrit :
> However, this means that we know there are not two interoperable
> implementations of this part of CSS 4 Selectors, so it shouldn't be
> able to progress to PR.  Since browsers all behave the same, it makes
> the most sense to just spec what browsers do, and add a test.  I don't
> see any justification for keeping the spec as-is except if you think
> that the spec should be theoretically pure rather than matching
> implementations.

I can imagine three kinds of behaviors:

1. Comparing (a, b, c) tuples in lexicographic order.
2. Choosing a "high" base and getting a single number with something
    like:  specificity = (a*BASE + b)*BASE + c
    2a. Clamping each of a, b and c to a BASE - 1
    2b. or allowing overflow

In my opinion:
1 is "most correct"; 2a and 2b are good enough approximations that can 
make matching more efficient. Getting interoperability on this is not 
important. The current wording is vague enough to allow either behavior. 
At most the spec could be changed to explicitly allow either. I don’t 
think it should mandate one or the other.

Also note that this issue is not new in Level 4. Browsers probably had 
the same behavior for a while and CSS1 already had the same wording:

http://www.w3.org/TR/CSS1/#cascading-order

Regards,
-- 
Simon Sapin

Received on Friday, 17 August 2012 14:41:16 UTC