Skip to content

Commit e2cac5f

Browse files
fix(css): read a block owner's at-keyword through _atKeywordOf when ordering declarations
#22569 removed `path.atKeyword` while #22513 added a call to it, so minifying any at-rule block holding more than one declaration, such as `@font-face`, threw. Claude-Session: https://claude.ai/code/session_01ViD41i2KdwwGxrDk7yrjeD
1 parent 8953192 commit e2cac5f

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎lib/css/syntax-parser.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17598,7 +17598,7 @@ const _composeBlockBody = (
1759817598
items.length > 1 &&
1759917599
owner !== null &&
1760017600
(path.type(owner) === T_QUALIFIED_RULE ||
17601-
_NESTED_GROUP_AT_RULES.has(path.atKeyword(owner))) &&
17601+
_NESTED_GROUP_AT_RULES.has(_atKeywordOf(owner))) &&
1760217602
_writesOnlyDeclarations(path, items, texts)
1760317603
? []
1760417604
: null;

‎test/unitCases/CssSyntax.unittest.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15529,7 +15529,9 @@ describe("CssSyntax minify — declaration order", () => {
1552915529
// Members of one family, whose relation a spec may change before data does.
1553015530
"a{flex-line-count:2;flex-flow:wrap}",
1553115531
// WebKit reads `size` as `width` and `height`, which no dataset says.
15532-
"a{width:var(--a);size:var(--b)}"
15532+
"a{width:var(--a);size:var(--b)}",
15533+
// Descriptors of an at-rule that holds no style rules.
15534+
"@font-face{src:url(a.woff);font-family:x}"
1553315535
])("keeps %s as written", (css) => {
1553415536
expect(settled(css, modern)).toBe(css);
1553515537
});

0 commit comments

Comments
 (0)