W3C home > Mailing lists > Public > www-style@w3.org > August 2012

Re: [selectors4] Specificity in base 256

From: Simon Sapin <simon.sapin@kozea.fr>
Date: Fri, 17 Aug 2012 16:40:53 +0200
Message-ID: <502E57F5.3010302@kozea.fr>
To: www-style@w3.org
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:58 GMT