Skip to content

Commit 9718523

Browse files
authored
Fix child combinators in :where (#210)
1 parent ddac36a commit 9718523

File tree

2 files changed

+1312
-1302
lines changed

2 files changed

+1312
-1302
lines changed

src/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,23 @@ function inWhere(selector, { className, prefix }) {
1414
let prefixedNot = prefix(`.not-${className}`).slice(1)
1515

1616
if (selector.endsWith('::before')) {
17+
if (selector.startsWith('>')) {
18+
return `> :where(${selector.slice(2, -8)}):not(:where([class~="${prefixedNot}"] *))::before`
19+
}
1720
return `:where(${selector.slice(0, -8)}):not(:where([class~="${prefixedNot}"] *))::before`
1821
}
1922

2023
if (selector.endsWith('::after')) {
24+
if (selector.startsWith('>')) {
25+
return `> :where(${selector.slice(2, -8)}):not(:where([class~="${prefixedNot}"] *))::before`
26+
}
2127
return `:where(${selector.slice(0, -7)}):not(:where([class~="${prefixedNot}"] *))::after`
2228
}
2329

30+
if (selector.startsWith('>')) {
31+
return `> :where(${selector.slice(2)}):not(:where([class~="${prefixedNot}"] *))`
32+
}
33+
2434
return `:where(${selector}):not(:where([class~="${prefixedNot}"] *))`
2535
}
2636

0 commit comments

Comments
 (0)