File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -76,10 +76,14 @@ public static function parse(ParserState $oParserState, bool $bIgnoreCase = fals
7676 // So, attempt to parse with the `a`, and allow for it not being there.
7777 switch ($ sColorMode ) {
7878 case 'rgb ' :
79+ $ colorModeForParsing = 'rgba ' ;
80+ $ mayHaveOptionalAlpha = true ;
81+ break ;
7982 case 'hsl ' :
80- $ colorModeForParsing = $ sColorMode . ' a ' ;
83+ $ colorModeForParsing = ' hsla ' ;
8184 $ mayHaveOptionalAlpha = true ;
8285 break ;
86+ // These two cases are handled identically.
8387 case 'rgba ' :
8488 case 'hsla ' :
8589 $ colorModeForParsing = $ sColorMode ;
@@ -88,7 +92,6 @@ public static function parse(ParserState $oParserState, bool $bIgnoreCase = fals
8892 default :
8993 $ colorModeForParsing = $ sColorMode ;
9094 $ mayHaveOptionalAlpha = false ;
91- break ;
9295 }
9396
9497 $ bContainsVar = false ;
@@ -105,7 +108,7 @@ public static function parse(ParserState $oParserState, bool $bIgnoreCase = fals
105108 // This must be done first, to consume comments as well, so that the `comes` test will work.
106109 $ oParserState ->consumeWhiteSpace ();
107110
108- // With a var argument, the function can have fewer arguments.
111+ // With a ` var` argument, the function can have fewer arguments.
109112 // And as of CSS Color Module Level 4, the alpha argument is optional.
110113 $ canCloseNow =
111114 $ bContainsVar ||
You can’t perform that action at this time.
0 commit comments