mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:47:45 +00:00
LibWeb: Port DOMParser interface from DeprecatedString to String
This commit is contained in:
parent
cc1e4c5cb3
commit
8531d11fab
3 changed files with 5 additions and 5 deletions
|
@ -33,7 +33,7 @@ void DOMParser::initialize(JS::Realm& realm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring
|
// 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.
|
// 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;
|
JS::GCPtr<DOM::Document> document;
|
||||||
|
@ -43,7 +43,7 @@ JS::NonnullGCPtr<DOM::Document> DOMParser::parse_from_string(DeprecatedString co
|
||||||
// -> "text/html"
|
// -> "text/html"
|
||||||
// 1. Set document's type to "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 = 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);
|
document->set_document_type(DOM::Document::Type::HTML);
|
||||||
|
|
||||||
// 2. Create an HTML parser parser, associated with document.
|
// 2. Create an HTML parser parser, associated with document.
|
||||||
|
@ -57,7 +57,7 @@ JS::NonnullGCPtr<DOM::Document> DOMParser::parse_from_string(DeprecatedString co
|
||||||
} else {
|
} else {
|
||||||
// -> Otherwise
|
// -> Otherwise
|
||||||
document = DOM::Document::create(realm(), verify_cast<HTML::Window>(relevant_global_object(*this)).associated_document().url());
|
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.
|
// 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 });
|
XML::Parser parser(string, { .resolve_external_resource = resolve_xml_resource });
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
|
|
||||||
virtual ~DOMParser() override;
|
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:
|
private:
|
||||||
explicit DOMParser(JS::Realm&);
|
explicit DOMParser(JS::Realm&);
|
||||||
|
|
|
@ -9,7 +9,7 @@ enum DOMParserSupportedType {
|
||||||
};
|
};
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparser
|
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparser
|
||||||
[Exposed=Window, UseDeprecatedAKString]
|
[Exposed=Window]
|
||||||
interface DOMParser {
|
interface DOMParser {
|
||||||
constructor();
|
constructor();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue