Support :where pseudo class
Closed this issue · 7 comments
Would it be sensible to implement support for the :where
pseudo class selector?
Happy to accept a PR for this! You'd have to add this to css-what
in
fb55/css-what#288 should be a good example for a PR. Once it can be parsed, the new alias has to be added here:
css-select/src/pseudo-selectors/subselects.ts
Lines 54 to 58 in 30013a5
Also please add a basic test cases to make sure we won't accidentally drop support for it.
Are you suggesting that :where
should be implemented as an alias for :is
/:matches
? I am not entirely certain if this library has to respect specificity, which works differently for :where
:
The difference between :where() and :is() is that :where() always has 0 specificity, whereas :is() takes on the specificity of the most specific selector in its arguments.
Yes, I am suggesting to just create an alias. Specificity is important for deciding which selectors have precedence for which element when applying styles. That is out of scope for this library (and can be implemented in a separate module if needed).
@fb55 Sorry to ask this; Would it be possible to create a release with this fix/feature?
Critters is waiting for this fix too: GoogleChromeLabs/critters#90
Published as v4.2.0
.
Thank you very much 😃