- From: Oriol Brufau via GitHub <sysbot+gh@w3.org>
- Date: Sun, 28 Oct 2018 00:24:49 +0000
- To: public-css-archive@w3.org
https://github.com/w3c/csswg-drafts/blob/76eefbbee09d3929d7ad1aa45be8446918ff304b/selectors-4/Overview.bs#L1124 Typo: extra `]` in `[hidden]]` https://github.com/w3c/csswg-drafts/blob/76eefbbee09d3929d7ad1aa45be8446918ff304b/selectors-4/Overview.bs#L3317 Typo: `'':matches''` should be `'':matches()''`, otherwise it's not linked. https://github.com/w3c/csswg-drafts/blob/76eefbbee09d3929d7ad1aa45be8446918ff304b/selectors-4/Overview.bs#L3319 Suggestion: link "complex selector" to https://drafts.csswg.org/selectors-4/#complex https://github.com/w3c/csswg-drafts/blob/76eefbbee09d3929d7ad1aa45be8446918ff304b/selectors-4/Overview.bs#L3336-L3337 https://github.com/w3c/csswg-drafts/blob/76eefbbee09d3929d7ad1aa45be8446918ff304b/selectors-4/Overview.bs#L3347-L3348 https://github.com/w3c/csswg-drafts/blob/76eefbbee09d3929d7ad1aa45be8446918ff304b/selectors-4/Overview.bs#L3352 `:not` has a different text than `:matches` and `:nth-child`, this may make people think their specificity is not calculated in the same way. Since the point is that the element doesn't matter, I would just use "whenever it matches any element" in all three cases. I would also prefer if the specificity was defined with a properly clear algorithm. The current one can be ambiguous, e.g. in https://github.com/w3c/csswg-drafts/blob/76eefbbee09d3929d7ad1aa45be8446918ff304b/selectors-4/Overview.bs#L3301 people may think ID selectors inside `:matches` should also be counted, but it's only the "top-level" ones. Something like this: > Given a selector *s* and an element *e* which is matched by *s*, the **specificity** of *s* in *e* is calculated as follows: > > 1. If *s* is a complex selector, return the absolute specificity of *s*. > 2. Else, *s* is a selector list. Return the maximum among the absolute specificities of the selectors in the list that match *e*. > > The **absolute specificity** of a selector *s* is calculated as follows: > > 1. If *s* is an universal selector, or a `:where()` pseudo-class selector, return (0,0,0). > 2. If *s* is a type selector or a pseudo-element, return (0,0,1). > 3. If *s* is a `:matches()`, `:not()`, or `:has()` pseudo-class selector, return the absolute specificity of its selector list argument. > 4. If *s* is a `:nth-child()`, or `:nth-last-child()` pseudo-class selector, return (0,1,0) plus the absolute specificity of its selector list argument (if any). > 5. If *s* is a class, attribute, or pseudo-class selector, return (0,1,0). > 6. If *s* is an ID selector, return (1,0,0). > 7. If *s* is a compound selector, return the sum of the absolute specificities of the simple selectors in *s*. > 8. If *s* is a complex selector, return the sum of the absolute specificities of the compound selectors in *s*. > 9. Else, *s* is a selector list. Return the maximum among the absolute specificities of the selectors in the list. -- GitHub Notification of comment by Loirooriol Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1027#issuecomment-433666117 using your GitHub account
Received on Sunday, 28 October 2018 00:24:50 UTC