Support for the :where pseudoclass function
See original GitHub issueHi there! Crossposting an issue from https://github.com/stylelint/stylelint/issues/5065 submitted by @jonathantneal.
It seems as if specificity
doesn’t properly support the rules around the :where()
pseudoclass function. In particular, the spec ref says:
Unlike
:is()
, neither the:where()
pseudo-class, nor any of its arguments, contribute to the specificity of the selector—its specificity is always zero.
In contrast, trying this out in the Specificity Calculator or using the library, cases like :where(hr)
have a nonzero specificity.
(in turn, this has triggered an issue in stylelint’s no-descending-specificity
rule)
I’m not familiar with this package, but more than happy to take a look at what needs to be done!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:17 (4 by maintainers)
Top Results From Across the Web
Pseudo-classes - CSS: Cascading Style Sheets | MDN
A pseudo-class consists of a colon ( : ) followed by the pseudo-class name (e.g., :hover ). A functional pseudo-class also contains a...
Read more >New CSS functional pseudo-class selectors :is() and :where()
When writing CSS, they give you a way to group elements together in the middle, beginning or end of a selector.
Read more >:is() CSS pseudo-class | Can I use... Support tables ... - CanIUse
The :is() (formerly :matches() , formerly :any() ) pseudo-class checks whether the element at its position in the outer selector matches any of...
Read more >CSS Pseudo-classes - W3Schools
CSS Pseudo-classes ; selector:pseudo-class · property · value ; /* unvisited link */ a:link { color: #FF0000; } /* visited link */ a:visited...
Read more >CSS :where() Pseudo-Class - GeeksforGeeks
The :where() pseudo-class is helpful for minimization of longer code in a longer CSS selector list. It avoids repetition, just replace ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looks like @bramus did the work and implemented the CSSTree approach in a new library: https://github.com/bramus/js-specificity
Any progress on this? I’ve been reviewing normalize/reset stylesheets and a significant amount of them are utilizing
:where()
. It’s rather confusing coming to the css specificity calculator to see it not working. If it’s not supported there should at least be an alert stating it’s not supported.