1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 15:17:45 +00:00

LibWeb: Support DOMImplementation.createDocument() doctype parameter

1% progression on ACID3. :^)
This commit is contained in:
Andreas Kling 2022-03-02 08:56:17 +01:00
parent a9c9c8c076
commit 05e9dceba6
3 changed files with 5 additions and 6 deletions

View file

@ -20,7 +20,7 @@ DOMImplementation::DOMImplementation(Document& document)
}
// https://dom.spec.whatwg.org/#dom-domimplementation-createdocument
ExceptionOr<NonnullRefPtr<Document>> DOMImplementation::create_document(const String& namespace_, const String& qualified_name) const
ExceptionOr<NonnullRefPtr<Document>> DOMImplementation::create_document(const String& namespace_, const String& qualified_name, RefPtr<DocumentType> doctype) const
{
// FIXME: This should specifically be an XML document.
auto xml_document = Document::create();
@ -36,7 +36,8 @@ ExceptionOr<NonnullRefPtr<Document>> DOMImplementation::create_document(const St
element = new_element.release_value();
}
// FIXME: If doctype is non-null, append doctype to document.
if (doctype)
xml_document->append_child(doctype.release_nonnull());
if (element)
xml_document->append_child(element.release_nonnull());

View file

@ -27,8 +27,7 @@ public:
return adopt_own(*new DOMImplementation(document));
}
// FIXME: Add optional DocumentType once supported by IDL
ExceptionOr<NonnullRefPtr<Document>> create_document(const String&, const String&) const;
ExceptionOr<NonnullRefPtr<Document>> create_document(String const&, String const&, RefPtr<DocumentType>) const;
NonnullRefPtr<Document> create_html_document(const String& title) const;
ExceptionOr<NonnullRefPtr<DocumentType>> create_document_type(String const& qualified_name, String const& public_id, String const& system_id);

View file

@ -2,9 +2,8 @@
interface DOMImplementation {
// FIXME: This is missing "optional DocumentType? doctype = null" at the end.
// FIXME: This should return XMLDocument instead of Document.
[NewObject] Document createDocument(DOMString? namespace, [LegacyNullToEmptyString] DOMString qualifiedName);
[NewObject] Document createDocument(DOMString? namespace, [LegacyNullToEmptyString] DOMString qualifiedName, optional DocumentType? doctype = null);
[NewObject] Document createHTMLDocument(optional DOMString title);
[NewObject] DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);