You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f733496
Browse filesBrowse the repository at this point in the historyBrowse files
fix(css): read a color function's separator grammar before folding it
`_COLOR_ARGUMENT_RE` states the runs between the separators without saying
which separator stood there, so every spelling collapsed to the same
argument list and a mixed one folded: `hsl(120, 50% 50%)` became `#40bf40`,
and `lch(50, 20, 30)` and `oklch(0.5, 0.1, 30)` folded although the Lab
family was specified after the legacy form and has no comma grammar at all.
Each is a declaration an engine drops, so folding it changed what rendered.
The arguments are now checked against the two grammars CSS Color 4 states —
`A B C` with an optional `/ D`, and the legacy `A, B, C` with an optional
`, D`, which `hsl()` alone among these functions has. That subsumes the
percentage guard this branch added, which asked `inner.includes(",")`.
`rgb()` reads its arguments through a scanner of its own in
`_minifyColorFunction` and has the same defect; it is left for its own
change rather than widened into this one.
"/*! the modern grammar takes a bare number for the two channels after the hue,
60
60
so these name the colors their percentage spellings do */.h09{color:#40bf40;background:#933}",
61
-
"/*! declined: the legacy comma form takes percentages alone, so a bare number
62
-
there is invalid CSS rather than a color to fold */.h10{color:hsl(120,50,50);background:hwb(0,20,40)}",
61
+
"/*! declined: \`hsl()\`'s legacy comma form takes percentages alone, and \`hwb()\`
62
+
has no comma form at all — both spellings are invalid CSS, not a color */.h10{color:hsl(120,50,50);background:hwb(0,20,40)}",
63
+
"/*! declined: a spelling mixing the two grammars matches neither, so the
64
+
channels are read as written rather than folded */.h11{color:hsl(120,50%50%);background:hsl(12050%,50%)}.h12{color:hsl(120,50%,50%/.5);background:hsl(12050%50%,.5)}",
65
+
"/*! ...including one with no separator before the alpha, and one where a \`/\`
66
+
stands between the channels */.h13{color:hsl(12050%50%.5);background:hsl(120/50%/50%)}",
67
+
"/*! declined: the Lab family was specified after the legacy form and takes the
68
+
modern grammar only, so a comma there is invalid however it is spelled */.h14{color:lch(50,20,30);background:oklch(.5,.1,30)}",
63
69
"/*! declined: the stops interpolate in the space the gradient names, and a
64
70
color converted through sRGB maps back into it as a different point */.g01{background-image:linear-gradient(90deginlch,red,lch(502030))}.g02{background-image:linear-gradient(inoklch,red,oklch(.7.1200))}",
65
71
"/*! declined without a space too: a stop outside sRGB is handed back as written
"/*! the modern grammar takes a bare number for the two channels after the hue,
60
60
so these name the colors their percentage spellings do */.h09{color:#40bf40;background:#933}",
61
-
"/*! declined: the legacy comma form takes percentages alone, so a bare number
62
-
there is invalid CSS rather than a color to fold */.h10{color:hsl(120,50,50);background:hwb(0,20,40)}",
61
+
"/*! declined: \`hsl()\`'s legacy comma form takes percentages alone, and \`hwb()\`
62
+
has no comma form at all — both spellings are invalid CSS, not a color */.h10{color:hsl(120,50,50);background:hwb(0,20,40)}",
63
+
"/*! declined: a spelling mixing the two grammars matches neither, so the
64
+
channels are read as written rather than folded */.h11{color:hsl(120,50%50%);background:hsl(12050%,50%)}.h12{color:hsl(120,50%,50%/.5);background:hsl(12050%50%,.5)}",
65
+
"/*! ...including one with no separator before the alpha, and one where a \`/\`
66
+
stands between the channels */.h13{color:hsl(12050%50%.5);background:hsl(120/50%/50%)}",
67
+
"/*! declined: the Lab family was specified after the legacy form and takes the
68
+
modern grammar only, so a comma there is invalid however it is spelled */.h14{color:lch(50,20,30);background:oklch(.5,.1,30)}",
63
69
"/*! declined: the stops interpolate in the space the gradient names, and a
64
70
color converted through sRGB maps back into it as a different point */.g01{background-image:linear-gradient(90deginlch,red,lch(502030))}.g02{background-image:linear-gradient(inoklch,red,oklch(.7.1200))}",
65
71
"/*! declined without a space too: a stop outside sRGB is handed back as written
0 commit comments