Skip to content

Fix crash on selector() after another @supports condition - #1568

Merged
ai merged 1 commit into
postcss:mainfrom
onmax:fix-supports-selector-after-condition
Nov 16, 2026
Merged

ai merged 1 commit into
postcss:mainfrom
onmax:fix-supports-selector-after-condition

Conversation

@onmax

@onmax onmax commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Autoprefixer 10.6.2 throws Unknown node type in node creation when selector() with a pseudo-element or pseudo-class comes after another @supports condition:

@supports (display: grid) and selector(::details-content) {}

The same query with selector() first works.

Supports#normalize() only joins a selector(...) group back into one string when selector is the first word. Here brackets.parse() gives [["display: grid"], " and selector", ["::details-content"]], so ::details-content looks like a (prop: value) pair. virtual() then splits it on : and appends a declaration with an empty prop, and PostCSS throws. selector(a) doesn't crash only because a becomes a declaration with an empty value.

This PR joins any bracket group that follows a string ending in selector with that string, so it stays an opaque string like the selector-first case. The new test in test/supports.test.js fails on main and passes here, and pnpm unit passes.

Browserslist defaults, PostCSS 8.5.32, Node 24.

@ai
ai merged commit 57486b2 into postcss:main Nov 16, 2026
9 checks passed
@ai

ai commented Nov 16, 2026

Copy link
Copy Markdown
Member

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants