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

LibWeb: Port XMLSerializer from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-11-20 21:32:29 +13:00 committed by Andreas Kling
parent e28fb5c64c
commit 6c42de3e8b
9 changed files with 46 additions and 52 deletions

View file

@ -1330,14 +1330,14 @@ void Node::string_replace_all(DeprecatedString const& string)
}
// https://w3c.github.io/DOM-Parsing/#dfn-fragment-serializing-algorithm
WebIDL::ExceptionOr<DeprecatedString> Node::serialize_fragment(DOMParsing::RequireWellFormed require_well_formed) const
WebIDL::ExceptionOr<String> Node::serialize_fragment(DOMParsing::RequireWellFormed require_well_formed) const
{
// 1. Let context document be the value of node's node document.
auto const& context_document = document();
// 2. If context document is an HTML document, return an HTML serialization of node.
if (context_document.is_html_document())
return HTML::HTMLParser::serialize_html_fragment(*this).to_deprecated_string();
return HTML::HTMLParser::serialize_html_fragment(*this);
// 3. Otherwise, context document is an XML document; return an XML serialization of node passing the flag require well-formed.
return DOMParsing::serialize_node_to_xml_string(*this, require_well_formed);