LibWeb/CSS: Parse <single-transition-property> as a <custom-ident>

The specification also treats a transition name of `none` as invalid.
This commit is contained in:
Tim Ledbetter 2025-03-12 17:59:29 +00:00 committed by Jelle Raaijmakers
commit 5559c3cb4f
Notes: github-actions[bot] 2025-03-14 07:53:21 +00:00
2 changed files with 7 additions and 8 deletions

View file

@ -3822,15 +3822,15 @@ RefPtr<CSSStyleValue> Parser::parse_transition_value(TokenStream<ComponentValue>
continue;
}
if (tokens.next_token().is(Token::Type::Ident)) {
if (auto transition_property = parse_custom_ident_value(tokens, { { "none"sv } })) {
if (transition.property_name) {
dbgln_if(CSS_PARSER_DEBUG, "Transition property has multiple property identifiers");
return {};
}
auto ident = tokens.consume_a_token().token().ident();
if (auto property = property_id_from_string(ident); property.has_value())
transition.property_name = CustomIdentStyleValue::create(ident);
auto custom_ident = transition_property->custom_ident();
if (auto property = property_id_from_string(custom_ident); property.has_value())
transition.property_name = CustomIdentStyleValue::create(custom_ident);
continue;
}

View file

@ -2,10 +2,9 @@ Harness status: OK
Found 5 tests
3 Pass
2 Fail
5 Pass
Pass e.style['transition'] = "1s 2s 3s" should not set the property value
Pass e.style['transition'] = "-1s -2s" should not set the property value
Pass e.style['transition'] = "steps(1) steps(2)" should not set the property value
Fail e.style['transition'] = "none top" should not set the property value
Fail e.style['transition'] = "initial 1s" should not set the property value
Pass e.style['transition'] = "none top" should not set the property value
Pass e.style['transition'] = "initial 1s" should not set the property value