mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Don't treat "--" as a valid custom property name
This is reserved for future use by CSS.
This commit is contained in:
parent
38765fd617
commit
bf37f3400e
Notes:
github-actions[bot]
2025-06-25 16:10:47 +00:00
Author: https://github.com/tcl3
Commit: bf37f3400e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5210
Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 28 additions and 1 deletions
|
@ -11,11 +11,19 @@
|
|||
|
||||
namespace Web::CSS {
|
||||
|
||||
static bool is_invalid_custom_property_name_string(StringView string)
|
||||
{
|
||||
// https://drafts.csswg.org/css-variables-2/#typedef-custom-property-name
|
||||
// The <custom-property-name> production corresponds to this: it’s defined as any <dashed-ident>
|
||||
// (a valid identifier that starts with two dashes), except -- itself, which is reserved for future use by CSS.
|
||||
return string == "--"sv;
|
||||
}
|
||||
|
||||
// https://drafts.css-houdini.org/css-typed-om-1/#custom-property-name-string
|
||||
static bool is_a_custom_property_name_string(StringView string)
|
||||
{
|
||||
// A string is a custom property name string if it starts with two dashes (U+002D HYPHEN-MINUS), like --foo.
|
||||
return string.starts_with("--"sv);
|
||||
return string.starts_with("--"sv) && !is_invalid_custom_property_name_string(string);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue