ladybird/Userland/Libraries/LibWeb/HTML/HTMLDocument.cpp
Andreas Kling 8f927eaa68 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
2023-06-21 16:30:27 +02:00

28 lines
661 B
C++

/*
* Copyright (c) 2023, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/HTML/HTMLDocument.h>
namespace Web::HTML {
HTMLDocument::HTMLDocument(JS::Realm& realm, AK::URL const& url)
: Document(realm, url)
{
}
HTMLDocument::~HTMLDocument() = default;
WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLDocument>> HTMLDocument::construct_impl(JS::Realm& realm)
{
return HTMLDocument::create(realm);
}
WebIDL::ExceptionOr<JS::NonnullGCPtr<HTMLDocument>> HTMLDocument::create(JS::Realm& realm, AK::URL const& url)
{
return MUST_OR_THROW_OOM(realm.heap().allocate<HTMLDocument>(realm, realm, url));
}
}