Skip to content

Commit 262863d

Browse files
authored
fix #1631 (#1632)
1 parent bde1238 commit 262863d

File tree

6 files changed

+21
-2
lines changed

6 files changed

+21
-2
lines changed

plugins/postcss-is-pseudo-class/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes to PostCSS Is Pseudo Class
22

3+
### Unreleased (patch)
4+
5+
- Fix support for more complex selector patterns. `.a > :is(.b > .c)` -> `.a.b > .c`
6+
37
### 5.0.2
48

59
_June 10, 2025_

plugins/postcss-is-pseudo-class/dist/index.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

plugins/postcss-is-pseudo-class/dist/index.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

plugins/postcss-is-pseudo-class/src/split-selectors/complex/same-preceding-element.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export function samePrecedingElement(selector: parser.Container): boolean {
7575
}
7676

7777
const before = selector.nodes.slice(0, combinatorIndex);
78+
const after = selector.nodes.slice(isPseudoIndex + 1);
7879

7980
selector.each((node) => {
8081
node.remove();
@@ -88,5 +89,9 @@ export function samePrecedingElement(selector: parser.Container): boolean {
8889
selector.append(node);
8990
});
9091

92+
after.forEach((node) => {
93+
selector.append(node);
94+
});
95+
9196
return true;
9297
}

plugins/postcss-is-pseudo-class/test/complex.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,3 +324,8 @@ console.log(out.join(''));
324324
.ignore::before + :is(.b + .c) {
325325
order: 78;
326326
}
327+
328+
/* https: //github.com/csstools/postcss-plugins/issues/1631 */
329+
.c > :is(.a > .b) .d::before {
330+
order: 79;
331+
}

plugins/postcss-is-pseudo-class/test/complex.expect.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,3 +324,8 @@ console.log(out.join(''));
324324
.ignore::before + :is(.b + .c) {
325325
order: 78;
326326
}
327+
328+
/* https: //github.com/csstools/postcss-plugins/issues/1631 */
329+
.c.a > .b .d::before {
330+
order: 79;
331+
}

0 commit comments

Comments
 (0)