mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 08:56:40 +00:00
LibWeb: Port DOMParser interface from DeprecatedString to String
This commit is contained in:
parent
cc1e4c5cb3
commit
8531d11fab
|
@ -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 });
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
|
||||
virtual ~DOMParser() override;
|
||||
|
||||
JS::NonnullGCPtr<DOM::Document> parse_from_string(DeprecatedString const&, Bindings::DOMParserSupportedType type);
|
||||
JS::NonnullGCPtr<DOM::Document> parse_from_string(StringView, Bindings::DOMParserSupportedType type);
|
||||
|
||||
private:
|
||||
explicit DOMParser(JS::Realm&);
|
||||
|
|
|
@ -9,7 +9,7 @@ enum DOMParserSupportedType {
|
|||
};
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparser
|
||||
[Exposed=Window, UseDeprecatedAKString]
|
||||
[Exposed=Window]
|
||||
interface DOMParser {
|
||||
constructor();
|
||||
|
||||
|
|
Loading…
Reference in a new issue