diff --git a/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Libraries/LibWeb/CSS/Parser/Parser.cpp index ea7001aa938..b31aea2bd99 100644 --- a/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -1125,6 +1125,8 @@ Optional Parser::consume_a_declaration(TokenStream& input, Neste // 8. If decl’s name is a custom property name string, then set decl’s original text to the segment // of the original source text string corresponding to the tokens of decl’s value. + if (is_invalid_custom_property_name_string(declaration.name)) + return {}; if (is_a_custom_property_name_string(declaration.name)) { // TODO: If we could reach inside the source string that the TokenStream uses, we could grab this as // a single substring instead of having to reconstruct it. diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-variables/support/color-green-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-variables/support/color-green-ref.html new file mode 100644 index 00000000000..0eabe58c81f --- /dev/null +++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-variables/support/color-green-ref.html @@ -0,0 +1,13 @@ + + +CSS Reftest Reference + + +

This text must be green.

diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-variables/variable-supports-58.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-variables/variable-supports-58.html new file mode 100644 index 00000000000..98eb87a095b --- /dev/null +++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-variables/variable-supports-58.html @@ -0,0 +1,16 @@ + + +CSS Test: Test a property declaration in an @supports rule with property name "--". + + + + +

This text must be green.