|
@@ -33,7 +33,7 @@ void DOMParser::initialize(JS::Realm& realm)
|
|
|
}
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring
|
|
|
-JS::NonnullGCPtr<DOM::Document> DOMParser::parse_from_string(DeprecatedString const& string, Bindings::DOMParserSupportedType type)
|
|
|
+JS::NonnullGCPtr<DOM::Document> DOMParser::parse_from_string(StringView string, Bindings::DOMParserSupportedType type)
|
|
|
{
|
|
|
// 1. Let document be a new Document, whose content type is type and url is this's relevant global object's associated Document's URL.
|
|
|
JS::GCPtr<DOM::Document> document;
|
|
@@ -43,7 +43,7 @@ JS::NonnullGCPtr<DOM::Document> DOMParser::parse_from_string(DeprecatedString co
|
|
|
// -> "text/html"
|
|
|
// 1. Set document's type to "html".
|
|
|
document = HTML::HTMLDocument::create(realm(), verify_cast<HTML::Window>(relevant_global_object(*this)).associated_document().url());
|
|
|
- document->set_content_type(Bindings::idl_enum_to_deprecated_string(type));
|
|
|
+ document->set_content_type(Bindings::idl_enum_to_string(type).to_deprecated_string());
|
|
|
document->set_document_type(DOM::Document::Type::HTML);
|
|
|
|
|
|
// 2. Create an HTML parser parser, associated with document.
|
|
@@ -57,7 +57,7 @@ JS::NonnullGCPtr<DOM::Document> DOMParser::parse_from_string(DeprecatedString co
|
|
|
} else {
|
|
|
// -> Otherwise
|
|
|
document = DOM::Document::create(realm(), verify_cast<HTML::Window>(relevant_global_object(*this)).associated_document().url());
|
|
|
- document->set_content_type(Bindings::idl_enum_to_deprecated_string(type));
|
|
|
+ document->set_content_type(Bindings::idl_enum_to_string(type).to_deprecated_string());
|
|
|
|
|
|
// 1. Create an XML parser parse, associated with document, and with XML scripting support disabled.
|
|
|
XML::Parser parser(string, { .resolve_external_resource = resolve_xml_resource });
|