diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp index 0e142e8bf1..f5f7bb5acd 100644 --- a/Userland/Services/WebContent/ConnectionFromClient.cpp +++ b/Userland/Services/WebContent/ConnectionFromClient.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -705,10 +706,17 @@ void ConnectionFromClient::replace_dom_node_attribute(i32 node_id, String const& return; auto& element = static_cast(*dom_node); - element.remove_attribute(name); + bool should_remove_attribute = true; + + for (auto const& attribute : replacement_attributes) { + if (should_remove_attribute && Web::Infra::is_ascii_case_insensitive_match(name, attribute.name)) + should_remove_attribute = false; - for (auto const& attribute : replacement_attributes) element.set_attribute(attribute.name, attribute.value).release_value_but_fixme_should_propagate_errors(); + } + + if (should_remove_attribute) + element.remove_attribute(name); } void ConnectionFromClient::remove_dom_node(i32 node_id)