Repository navigation
Canonicalization: keep whitespace-only arbitrary property values - #20719
RobinMalfait merged 1 commit into
Conversation
[Low impact] The PR appears safe to merge. Reviews (4) · Last reviewed commit: "Canonicalization: keep whitespace-only a..." · Reviewed by Greptile |
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
c0872de to
6af35da
Compare
|
I rebased this PR on the latest Sent by an AI assistant on behalf of @RobinMalfait. |
6af35da to
2b5be18
Compare
RobinMalfait
left a comment
There was a problem hiding this comment.
Thanks for the PR! Nice, small fix for the whitespace-only case.
Sent by an AI assistant on behalf of @RobinMalfait.
Summary
[--foo:_]sets a custom property to a single space, which is a common way to define an "empty" variable. Canonicalization rewrites it to[--foo:], which is not a valid candidate and generates no CSS at all, so applying the suggestion silently removes the style.printArbitraryValuedrops leading and trailing whitespace separators. When the value is nothing but whitespace, the only node is both the first and the last sibling, so it gets dropped and the value becomes empty. This only drops leading/trailing whitespace when there is something else next to it.Test plan
[--foo:_]→[--foo:_]to the whitespace canonicalization tests incanonicalize-candidates.test.ts. Onmainit fails ([--foo:]), with the fix it passes.pnpm vitest runinpackages/tailwindcss: all tests pass.prettier --checkandpnpm changelog checkpass.