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

LibWeb: Make DOMImplementation.createHTMLDocument() create HTMLDocument

Prior to this change, this API would actually create an XML Document(!)
This commit is contained in:
Andreas Kling 2024-03-09 20:57:15 +01:00
parent b9bacb3ff4
commit 99ca2ccf08
5 changed files with 28 additions and 2 deletions

View file

@ -12,6 +12,7 @@
#include <LibWeb/DOM/ElementFactory.h>
#include <LibWeb/DOM/Text.h>
#include <LibWeb/DOM/XMLDocument.h>
#include <LibWeb/HTML/HTMLDocument.h>
#include <LibWeb/HTML/Origin.h>
#include <LibWeb/Namespace.h>
@ -91,10 +92,11 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Document>> DOMImplementation::create_docume
JS::NonnullGCPtr<Document> DOMImplementation::create_html_document(Optional<String> const& title) const
{
// 1. Let doc be a new document that is an HTML document.
auto html_document = Document::create(realm());
auto html_document = HTML::HTMLDocument::create(realm());
// 2. Set docs content type to "text/html".
html_document->set_content_type("text/html"_string);
html_document->set_document_type(DOM::Document::Type::HTML);
html_document->set_ready_for_post_load_tasks(true);