Skip to content

Commit 41d76a2

Browse files
fix(css): lower an inset of a lone CSS-wide keyword again
The box-slot check refused `inset:inherit`, which every longhand reads; a keyword beside another value still stays, as the target drops it. Claude-Session: https://claude.ai/code/session_017TkBWTk3wcyUcJYDp5ZhaP
1 parent 7f5de9c commit 41d76a2

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

‎lib/css/syntax-parser.js‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18686,8 +18686,15 @@ const _expandUnsupportedShorthand = (text) => {
1868618686
if (box) {
1868718687
longhands = BOX_LONGHANDS.get(property);
1868818688
values = _expandBox(value, 4);
18689-
// A word no longhand reads drops the shorthand whole, and one longhand alone.
18690-
if (values !== null && _boxSlotsUnreadable(property, values)) return null;
18689+
// A word no longhand reads drops the shorthand whole, and one longhand alone;
18690+
// a CSS-wide keyword alone is read by every longhand.
18691+
if (
18692+
values !== null &&
18693+
!CSS_WIDE_KEYWORDS.has(toLowerCaseIfNeeded(value)) &&
18694+
_boxSlotsUnreadable(property, values)
18695+
) {
18696+
return null;
18697+
}
1869118698
} else {
1869218699
longhands = PAIR_LONGHANDS.get(property);
1869318700
const written = _splitPrintedComponents(value);

‎test/unitCases/css/printer.unittest.js‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15408,11 +15408,21 @@ describe("CssSyntax minify — a box family holding a value its longhand does no
1540815408

1540915409
it.each([
1541015410
["a word", "a{inset:1px 2px 3px foo}"],
15411+
["a CSS-wide keyword beside another value", "a{inset:inherit 0}"],
1541115412
["a call no box reads", "a{inset:auto 0 0 auto(}", "a{inset:auto 0 0 auto(})}"]
1541215413
])("leaves an `inset` holding %s for the target to drop", (_, css, out = css) => {
1541315414
expect(minifyFor(css, ["edge 18"])).toBe(out);
1541415415
});
1541515416

15417+
it.each(["inherit", "INITIAL", "unset", "revert-layer"])(
15418+
"still lowers an `inset` of the CSS-wide keyword %s",
15419+
(keyword) => {
15420+
expect(minifyFor(`a{inset:${keyword}}`, ["edge 18"])).toBe(
15421+
`a{top:${keyword};right:${keyword};bottom:${keyword};left:${keyword}}`
15422+
);
15423+
}
15424+
);
15425+
1541615426
it("still lowers an `inset` of what the offsets read", () => {
1541715427
expect(minifyFor("a{inset:calc(1px + 1%) anchor(top)}", ["edge 18"])).toBe(
1541815428
"a{top:calc(1px + 1%);right:anchor(top);bottom:calc(1px + 1%);left:anchor(top)}"

0 commit comments

Comments
 (0)