mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:37:43 +00:00
LibWeb/XML: Do not create text nodes for empty text chunks
This corresponds to the empty text node between foo and bar in `<foo/><bar/>`, which is not supposed to become a text node in HTML.
This commit is contained in:
parent
ae4e46a037
commit
830f1dbbfe
1 changed files with 4 additions and 2 deletions
|
@ -146,8 +146,10 @@ void XMLDocumentBuilder::text(StringView data)
|
||||||
auto string = DeprecatedString::empty();
|
auto string = DeprecatedString::empty();
|
||||||
if (!data.is_null())
|
if (!data.is_null())
|
||||||
string = data.to_deprecated_string();
|
string = data.to_deprecated_string();
|
||||||
auto node = m_document->create_text_node(MUST(String::from_deprecated_string(string)));
|
if (!string.is_empty()) {
|
||||||
MUST(m_current_node->append_child(node));
|
auto node = m_document->create_text_node(MUST(String::from_deprecated_string(string)));
|
||||||
|
MUST(m_current_node->append_child(node));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue