diff --git a/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Libraries/LibWeb/CSS/Parser/Parser.cpp index da48c2dd2e2..8c35548e0e4 100644 --- a/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -1309,15 +1309,21 @@ Vector> Parser::parse_a_comma_separated_list_of_component Vector> groups; // 3. While input is not empty: + bool just_consumed_comma = false; while (!input.is_empty()) { // 1. Consume a list of component values from input, with as the stop token, and append the result to groups. groups.append(consume_a_list_of_component_values(input, Token::Type::Comma)); // 2. Discard a token from input. - input.discard_a_token(); + just_consumed_comma = input.consume_a_token().is(Token::Type::Comma); } + // AD-HOC: Also append an empty group if there was a trailing comma. + // Some related spec discussion: https://github.com/w3c/csswg-drafts/issues/11254 + if (just_consumed_comma) + groups.append({}); + // 4. Return groups. return groups; } diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/parsing/font-variation-settings-invalid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/parsing/font-variation-settings-invalid.txt index c7bbf8da29d..2574d9ba10b 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/parsing/font-variation-settings-invalid.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/parsing/font-variation-settings-invalid.txt @@ -2,8 +2,7 @@ Harness status: OK Found 18 tests -17 Pass -1 Fail +18 Pass Pass e.style['font-variation-settings'] = "700" should not set the property value Pass e.style['font-variation-settings'] = "\"XHGT\"" should not set the property value Pass e.style['font-variation-settings'] = "wght 700" should not set the property value @@ -16,7 +15,7 @@ Pass e.style['font-variation-settings'] = "\"abcA9\" 0.5" should not set the pro Pass e.style['font-variation-settings'] = "'wght' 200 'abcd' 400" should not set the property value Pass e.style['font-variation-settings'] = "'a' 1234" should not set the property value Pass e.style['font-variation-settings'] = "'abcde' 1234" should not set the property value -Fail e.style['font-variation-settings'] = "'wght' 200, " should not set the property value +Pass e.style['font-variation-settings'] = "'wght' 200, " should not set the property value Pass e.style['font-variation-settings'] = "'abcd\" 123" should not set the property value Pass e.style['font-variation-settings'] = "'wght' 100px" should not set the property value Pass e.style['font-variation-settings'] = "'wght' calc(100px + 200px)" should not set the property value diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/mediaqueries/match-media-parsing.txt b/Tests/LibWeb/Text/expected/wpt-import/css/mediaqueries/match-media-parsing.txt index 066feea908f..03af42c3672 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/mediaqueries/match-media-parsing.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/mediaqueries/match-media-parsing.txt @@ -2,8 +2,8 @@ Harness status: OK Found 34 tests -30 Pass -4 Fail +32 Pass +2 Fail Pass Test parsing '' with matchMedia Pass Test parsing ' ' with matchMedia Pass Test parsing 'all' with matchMedia @@ -20,9 +20,9 @@ Pass Test parsing 'color)' with matchMedia Pass Test parsing ' color)' with matchMedia Pass Test parsing ' color ), ( color' with matchMedia Fail Test parsing ' foo ' with matchMedia -Fail Test parsing ',' with matchMedia +Pass Test parsing ',' with matchMedia Pass Test parsing ' , ' with matchMedia -Fail Test parsing ',,' with matchMedia +Pass Test parsing ',,' with matchMedia Pass Test parsing ' , , ' with matchMedia Fail Test parsing ' foo,' with matchMedia Pass Test parsing '(min-resolution: 1x)' with matchMedia