Closed
Description
Following my StackOverflow question
I would like to propose a pseudo-selector for selecting elements until the selector defined in the :until
part is encountered.
The main purpose is a repeating selector, for confined "groups" of matched elements, between certain constraints.
Use-cases for an :until
pseudo-selector:
For each div
with class active
select all of its following (next) <a>
siblings up until the first encountered div
selector (jsbin).
(the number of <a>
elements is unknown)
div.active ~ a:until(div) { color: red; }
<a>❤</a>
<a>❤</a>
<div class='active'></div>
<a>❤</a> <!-- should match this -->
<a>❤</a> <!-- should match this -->
<div></div>
<a>❤</a>
<a>❤</a>
<div class='active'></div>
<a>❤</a> <!-- should match this -->
Currently, there is a specificity problem if one simply write the below CSS selectors:
The selectors only match the first "group" of ` elements and then the second selector overrides the first selector for the rest of the anchor elements:
div.active ~ a { color: red; }
div:not(.active) ~ a { color: initial; }
Metadata
Metadata
Assignees
Type
Projects
Status
Done