Skip to content

Commit 2bbf578

Browse files
committed
LibWeb/CSS: Commit transaction when parsing valid anchor()
I'm honestly not sure how this worked before.
1 parent 1b1bb3b commit 2bbf578

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Libraries/LibWeb/CSS/Parser/ValueParsing.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,7 @@ RefPtr<StyleValue const> Parser::parse_anchor(TokenStream<ComponentValue>& token
877877
// <anchor()> = anchor( <anchor-name>? && <anchor-side>, <length-percentage>? )
878878

879879
auto transaction = tokens.begin_transaction();
880+
tokens.discard_whitespace();
880881
auto const& function_token = tokens.consume_a_token();
881882
if (!function_token.is_function("anchor"sv))
882883
return {};
@@ -937,6 +938,7 @@ RefPtr<StyleValue const> Parser::parse_anchor(TokenStream<ComponentValue>& token
937938
if (!anchor_side_value)
938939
return {};
939940

941+
transaction.commit();
940942
return AnchorStyleValue::create(anchor_name, anchor_side_value.release_nonnull(), fallback_value);
941943
}
942944

0 commit comments

Comments
 (0)