question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for the :where pseudoclass function

See original GitHub issue

Hi 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!

MDN ref & spec ref for :where().

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
bartvenemancommented, Feb 23, 2022

Looks like @bramus did the work and implemented the CSSTree approach in a new library: https://github.com/bramus/js-specificity

2reactions
timbomckaycommented, Feb 15, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found