1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 11:45:11 +00:00

LibWeb: Remove StringBuilders from HTMLToken::AttributeBuilder

This commit is contained in:
Gunnar Beutner 2021-05-23 08:50:48 +02:00 committed by Andreas Kling
parent 992964aa7d
commit 901d71148b
4 changed files with 41 additions and 33 deletions

View file

@ -437,7 +437,7 @@ NonnullRefPtr<DOM::Element> HTMLDocumentParser::create_element_for(const HTMLTok
{
auto element = create_element(document(), token.tag_name(), namespace_);
for (auto& attribute : token.m_tag.attributes) {
element->set_attribute(attribute.local_name_builder.to_string(), attribute.value_builder.to_string());
element->set_attribute(attribute.local_name, attribute.value);
}
return element;
}
@ -1120,9 +1120,9 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token)
if (m_stack_of_open_elements.contains(HTML::TagNames::template_))
return;
for (auto& attribute : token.m_tag.attributes) {
if (current_node().has_attribute(attribute.local_name_builder.string_view()))
if (current_node().has_attribute(attribute.local_name))
continue;
current_node().set_attribute(attribute.local_name_builder.to_string(), attribute.value_builder.to_string());
current_node().set_attribute(attribute.local_name, attribute.value);
}
return;
}
@ -1147,9 +1147,9 @@ void HTMLDocumentParser::handle_in_body(HTMLToken& token)
m_frameset_ok = false;
auto& body_element = m_stack_of_open_elements.elements().at(1);
for (auto& attribute : token.m_tag.attributes) {
if (body_element.has_attribute(attribute.local_name_builder.string_view()))
if (body_element.has_attribute(attribute.local_name))
continue;
body_element.set_attribute(attribute.local_name_builder.to_string(), attribute.value_builder.to_string());
body_element.set_attribute(attribute.local_name, attribute.value);
}
return;
}