1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:35:07 +00:00

LibWeb: Make HTMLDocumentParser take an existing document

We shouldn't really be creating the document objects inside the parser,
since that makes it hard to hook up e.g JavaScript bindings early on.
This commit is contained in:
Andreas Kling 2020-12-13 16:59:22 +01:00
parent 4dbecf0b65
commit 22c582a887
4 changed files with 14 additions and 19 deletions

View file

@ -214,7 +214,8 @@ bool FrameLoader::load(const URL& url, Type type)
void FrameLoader::load_html(const StringView& html, const URL& url)
{
HTML::HTMLDocumentParser parser(html, "utf-8");
auto document = DOM::Document::create(url);
HTML::HTMLDocumentParser parser(document, html, "utf-8");
parser.run(url);
frame().set_document(&parser.document());
}