Skip to content

Do not split {} blocks in custom property values - #52

Merged
ai merged 1 commit into
postcss:mainfrom
trackoor:custom-property-blocks
Nov 7, 2026
Merged

ai merged 1 commit into
postcss:mainfrom
trackoor:custom-property-blocks

Conversation

@trackoor

@trackoor trackoor commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #51.

Parser#decl always calls precheckMissedSemicolon, and the safe parser's version splits the value at a :. For a custom property like --y:{a:b; c:d} that : is inside the {} block, so the value got split into broken declarations. Now decl remembers whether it is parsing a custom property and precheckMissedSemicolon skips the split in that case.

This also makes the shared apply.css and custom-properties.css cases from postcss-parser-tests pass, so I removed the skip for them. Missed semicolons in regular declarations (a{color:red b:c}) are still fixed. Unit tests, lint and test/integration.js pass.

@ai
ai merged commit 0ee2a4f into postcss:main Nov 7, 2026
5 checks passed
@ai

ai commented Nov 7, 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.

Custom property values with a {...} block are split into broken declarations

2 participants