mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-17 16:28:06 +03: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
Notes:
sideshowbarker
2024-07-17 00:37:23 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/830f1dbbfe Pull-request: https://github.com/SerenityOS/serenity/pull/21365
@ -146,8 +146,10 @@ void XMLDocumentBuilder::text(StringView data)
|
||||
auto string = DeprecatedString::empty();
|
||||
if (!data.is_null())
|
||||
string = data.to_deprecated_string();
|
||||
auto node = m_document->create_text_node(MUST(String::from_deprecated_string(string)));
|
||||
MUST(m_current_node->append_child(node));
|
||||
if (!string.is_empty()) {
|
||||
auto node = m_document->create_text_node(MUST(String::from_deprecated_string(string)));
|
||||
MUST(m_current_node->append_child(node));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user