-
Notifications
You must be signed in to change notification settings - Fork 682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-cascade] Clarify the specificity of a declaration. #11305
Comments
The [selectors] spec section linked from that paragraph contains the detailed algorithm of specificity calculation, including the following paragraph:
It doesn't strictly declare the equivalence between "the specificity in effect" and "the specificity of the rule" (though strongly implies it), but seems quite unobvious which specificity value will be in effect for any given selector, and therefore for the rule associated with it. IMO making the text too verbose while providing the link to the detailed algorithm would be not very useful, however a minor editorial change to remove the rest of ambiguity from it could be helpful. |
This links to https://www.w3.org/TR/selectors/#specificity which explains how to calculate specificity. |
Oh wait, reopening as I didn’t see your suggestion at the end there. |
Technically even better is to say that declarations have no specificity, because it’s the selector that determines that. |
Maybe the text like this would be better than existing one?
|
That works for me. Getting rid of the notion of declarations and rules having specificity seems the neatest approach. |
Every Cascade spec level from 3 to 6 contains the same text for the specificity of a declaration - "Each declaration has the same specificity as the style rule it appears in."
But as far as I can tell, nothing says what the specificity of a rule is. After all what is the specificity of this rule?
p, #x, .y { color: red }
I think the text should say something like "Each declaration has the same specificity as the highest specificity matching selector belonging to the rule it appears in."
The text was updated successfully, but these errors were encountered: