diff --git a/Tests/LibWeb/Text/expected/unclosed-body-element.txt b/Tests/LibWeb/Text/expected/unclosed-body-element.txt new file mode 100644 index 0000000000..f769a25f8f --- /dev/null +++ b/Tests/LibWeb/Text/expected/unclosed-body-element.txt @@ -0,0 +1 @@ + Body element has '
+
+
+
+
diff --git a/Tests/LibWeb/Text/input/unclosed-html-element.html b/Tests/LibWeb/Text/input/unclosed-html-element.html
new file mode 100644
index 0000000000..c1bab5c6f6
--- /dev/null
+++ b/Tests/LibWeb/Text/input/unclosed-html-element.html
@@ -0,0 +1,10 @@
+
+
+
+
+
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp
index 2fe7f11f56..2353957893 100644
--- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp
@@ -1721,7 +1721,7 @@ void HTMLParser::handle_in_body(HTMLToken& token)
// If it is not, add the attribute and its corresponding value to that element.
token.for_each_attribute([&](auto& attribute) {
if (!current_node().has_attribute(attribute.local_name))
- MUST(current_node().set_attribute(attribute.local_name, attribute.value));
+ current_node().append_attribute(attribute.local_name, attribute.value);
return IterationDecision::Continue;
});
return;
@@ -1743,7 +1743,6 @@ void HTMLParser::handle_in_body(HTMLToken& token)
// -> A start tag whose tag name is "body"
if (token.is_start_tag() && token.tag_name() == HTML::TagNames::body) {
-
// Parse error.
log_parse_error();
@@ -1763,7 +1762,7 @@ void HTMLParser::handle_in_body(HTMLToken& token)
auto& body_element = m_stack_of_open_elements.elements().at(1);
token.for_each_attribute([&](auto& attribute) {
if (!body_element->has_attribute(attribute.local_name))
- MUST(body_element->set_attribute(attribute.local_name, attribute.value));
+ body_element->append_attribute(attribute.local_name, attribute.value);
return IterationDecision::Continue;
});
return;