LibWeb+LibXML: Preserve element attribute order in XML documents

We now use OrderedHashMap instead of HashMap to ensure that attributes
on XML elements retain their original order.
This commit is contained in:
Andreas Kling 2025-08-21 12:11:41 +02:00 committed by Andreas Kling
commit b7595013c1
Notes: github-actions[bot] 2025-08-22 09:37:04 +00:00
7 changed files with 22 additions and 6 deletions

View file

@ -700,7 +700,7 @@ ErrorOr<NonnullOwnPtr<Node>, ParseError> Parser::parse_empty_element_tag()
TRY(expect("<"sv));
auto name = TRY(parse_name());
HashMap<Name, ByteString> attributes;
OrderedHashMap<Name, ByteString> attributes;
while (true) {
if (auto result = skip_whitespace(Required::Yes); result.is_error())
@ -854,7 +854,7 @@ ErrorOr<NonnullOwnPtr<Node>, ParseError> Parser::parse_start_tag()
auto accept = accept_rule();
auto name = TRY(parse_name());
HashMap<Name, ByteString> attributes;
OrderedHashMap<Name, ByteString> attributes;
while (true) {
if (auto result = skip_whitespace(Required::Yes); result.is_error())