Repository navigation
Comma-separated hsl() takes a number saturation or lightness, which its legacy syntax refuses
#1414
YevheniiKotyrlo
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The comma-separated
hsl()andhsla()take only percentages for saturation and lightness (CSS Color 4); numbers belong to the space-separated syntax. lightningcss takes numbers in the comma-separated form too, so the minifier turns a color a browser drops into one it applies:.a{color:red;color:hsl(0, 50, 30%)}minifies to.a{color:#732626}, where a browser keepsred. The declarations are the invalid cases of web-platform-tests'css/css-color/parsing/color-invalid-hsl.html.Reproducer
repro.shbuildsmain.rsagainst lightningcss'smaster, parses each declaration withProperty::parse_string, and minifies it in a rule withStyleSheet::parse,minifyandto_css.Steps to reproduce
git clone https://gist.github.com/YevheniiKotyrlo/d1f15479f832b104781ad3ba661bb2bb repro && cd reprobash repro.sh, which exits 1 while a comma-separatedhsl()with a number saturation or lightness parses as a color.Expected result
The five comma-separated colors with a number are left unparsed, and
.a{color:red;color:hsl(0, 50, 30%)}keepsred.hsl(120, 100%, 50%)andhsl(120 100 50)parse as they do now.Actual result
Versions and platform
All reactions