Keep layers comma-separated when exporting a multi-layer shorthand - #197
Merged
TylerBrinks merged 1 commit intoJul 23, 2026
Merged
Conversation
EndListValueConverter.ListValue.ExtractFor joined the per-layer values with whitespace while its own CssText, and ListValueConverter's equivalent ExtractFor, both join with a comma. Exporting a multi-layer shorthand to its longhands therefore ran the layers together into one invalid value instead of a comma-separated list: background: url(a.png) no-repeat, url(b.png) repeat background-repeat -> "no-repeat repeat" (one invalid layer) background-image -> "initial" (conversion failed outright) Use Token.Comma, matching the sibling converter.
jhaygood86
marked this pull request as ready for review
July 22, 2026 21:36
jhaygood86
marked this pull request as draft
July 22, 2026 21:40
jhaygood86
marked this pull request as ready for review
July 22, 2026 21:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
EndListValueConverter.ListValue.ExtractForjoins the per-layer values with whitespace:but its own
CssTextjoins with", ", andListValueConverter.ExtractFor— the sibling that handles plain comma lists — usesToken.Comma.EndListValueConverteris the one behindbackground, where a final layer may additionally carrybackground-color.The result is that exporting a multi-layer shorthand to its longhands runs the layers together into a single invalid value:
background-repeatno-repeat repeatno-repeat, repeatbackground-imageinitialurl("a.png"), url("b.png")background-repeatbecomes one invalid two-keyword layer rather than two valid ones.background-imageis worse: the whitespace-joinedurl("a.png") url("b.png")doesn't convert at all, so the longhand ends up with no value and reportsinitial.Each comma-separated layer is its own layer for every longhand the shorthand covers (CSS Backgrounds 3 §2.1).
Fix
Use
Token.Comma, matchingListValueConverter.Tests
2 tests in
PropertyTests/BackgroundProperty.cs, covering two- and three-layer backgrounds and asserting bothbackground-imageandbackground-repeat. Both fail onmaster.The full suite (1263 existing tests) stays green with no existing assertion modified, and all seven target frameworks build with no new warnings.