LibWeb/CSS: Commit transaction when parsing valid anchor()

I'm honestly not sure how this worked before.
This commit is contained in:
Sam Atkins 2025-10-30 15:06:01 +00:00
parent 1b1bb3b897
commit 2bbf578737
Notes: github-actions[bot] 2025-11-03 11:25:14 +00:00

View file

@ -877,6 +877,7 @@ RefPtr<StyleValue const> Parser::parse_anchor(TokenStream<ComponentValue>& token
// <anchor()> = anchor( <anchor-name>? && <anchor-side>, <length-percentage>? )
auto transaction = tokens.begin_transaction();
tokens.discard_whitespace();
auto const& function_token = tokens.consume_a_token();
if (!function_token.is_function("anchor"sv))
return {};
@ -937,6 +938,7 @@ RefPtr<StyleValue const> Parser::parse_anchor(TokenStream<ComponentValue>& token
if (!anchor_side_value)
return {};
transaction.commit();
return AnchorStyleValue::create(anchor_name, anchor_side_value.release_nonnull(), fallback_value);
}