Skip to content

fix: exclude leaf pseudo selectors from the nesting limit - #375

Merged
MoOx merged 2 commits into
postcss:mainfrom
Aschenbath:fix/50-selector-leaf-pseudo-depth-20261125-42bb
Nov 26, 2026
Merged

MoOx merged 2 commits into
postcss:mainfrom
Aschenbath:fix/50-selector-leaf-pseudo-depth-20261125-42bb

Conversation

@Aschenbath

Copy link
Copy Markdown
Contributor

Nonfunctional pseudo selectors such as :hover and ::before are accepted by the parser at maxNestingDepth: 0, but serialization rejects them. The same problem affects leaf pseudos inside a functional pseudo at the configured limit, such as :is(a:hover) with a limit of one.

Count a pseudo toward the serialization limit only when it has argument children. Regression tests cover both processor and AST serialization entry points and verify that nested functional pseudos still enforce the limit.

Validation: the two valid-selector regressions failed on the original source. All 1,079 tests pass with the fix, including the coverage gate, type checks, lint, and formatting checks.

AI assistance: implemented and tested with OpenAI Codex.

@MoOx
MoOx merged commit df80d22 into postcss:main Nov 26, 2026
4 checks passed
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