|
Convenient web based access to our favorite web design Usenet groups
|
 |
This is Interesting: Free Magazines for Graphics designers and webmasters
| Author |
| Thread |
 |
|
|
|
|
|
 |
 |
|
|
 |
 |
Re: Calculating CSS Selector Specificity |
 |
|
 |
|
|
|
  08-25-06 - 11:45 PM
|
sajid@fendoo.com wrote:
> The CSS 2.1 Specification describes how to sort a list of selectors in
> order of specificity, but it doesn't provide a method to calculate the
> specificity of a single selector in isolation.
Of course they do. www.w3.org/TR/CSS2/cascade.html#specificity
>
> I've devised a method to do this, which I describe in the following
> article:
>
> http://calculating-css-selector-spe...y.blogspot.com/
In which you wrote, "A method currently popular is to simply concatenate
the numbers a, b, c and d into a single decimal number
Selector Specificity Specificity Value
p#title.red 0, 1, 1, 1 0111 = 111
But this method fails if one of b, c, or d is greater than 9."
This demonstrates that you overlooked their examples, in which they did
exactly this--concatenating the numbers, treating them as digits base
10--and the part where they wrote "in a number system with a large
base", which deals head-on with the case where any of the numbers is
greater than 9. In other words, this isn't a "method currently popular".
It's the way the computation was defined.
|
|
|
| [
Post Follow-Up to this message ]
|
|
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
| All times are GMT. The time now is 05:39 PM. |
 |
|
|
|
|
|  |
|