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

LibWeb: Add HTMLDocument class

This class is currently not in the spec, but it *is* still in all the
major browser engines. For compatibility reasons, let's do what other
engines do.

There is discussion about bringing HTMLDocument back into specs:
- https://github.com/whatwg/html/issues/4792
- https://github.com/whatwg/dom/issues/221
This commit is contained in:
Andreas Kling 2023-06-21 13:53:09 +02:00
parent 40e7f64433
commit 8f927eaa68
8 changed files with 79 additions and 7 deletions

View file

@ -16,6 +16,7 @@
#include <LibWeb/HTML/CrossOrigin/CrossOriginOpenerPolicy.h>
#include <LibWeb/HTML/EventLoop/EventLoop.h>
#include <LibWeb/HTML/HTMLAnchorElement.h>
#include <LibWeb/HTML/HTMLDocument.h>
#include <LibWeb/HTML/HTMLInputElement.h>
#include <LibWeb/HTML/NavigableContainer.h>
#include <LibWeb/HTML/RemoteBrowsingContext.h>
@ -203,7 +204,7 @@ JS::NonnullGCPtr<BrowsingContext> BrowsingContext::create_a_new_browsing_context
// load timing info is loadTimingInfo,
// FIXME: navigation id is null,
// and which is ready for post-load tasks.
auto document = DOM::Document::create(window->realm()).release_value_but_fixme_should_propagate_errors();
auto document = HTML::HTMLDocument::create(window->realm()).release_value_but_fixme_should_propagate_errors();
// Non-standard
document->set_window(*window);
@ -361,7 +362,7 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext
verify_cast<WindowEnvironmentSettingsObject>(Bindings::host_defined_environment_settings_object(window->realm())).cross_origin_isolated_capability() == CanUseCrossOriginIsolatedAPIs::Yes);
// 14. Let document be a new Document, with:
auto document = TRY(DOM::Document::create(window->realm()));
auto document = TRY(HTML::HTMLDocument::create(window->realm()));
// Non-standard
document->set_window(*window);