Support the selectors with `:is()` and `:where()`
krassowski opened this issue · 0 comments
Problem
Selectors with comma are currently straight out rejected in a few places:
lumino/packages/widgets/src/contextmenu.ts
Lines 330 to 333 in 10d232e
lumino/packages/commands/src/index.ts
Lines 1561 to 1566 in 10d232e
This is understandable because the selector specificity can be only computed for individual selector, not a comma-separated list of selectors.
However, the :is()
and :where()
selectors now widely supported by browsers and take a comma-separated lists of selectors:
:is()
counts towards specificity with the specificity of the most specific element on the list:where()
counts with specificity of zero (so very easy to implement!)
Lack of support for :is
and :where
makes creating selectors for certain commands and context menu more difficult than it should be in 2024.
Proposed Solution
Implement support for :is()
and :where()
.
Additional context
Encountered this in jupyterlab/jupyterlab#15845 when trying to make the context menu show for .jp-RunningSessions-item:is(.jp-mod-kernel,.jp-mod-kernel-widget)
.