/src/serenity/Userland/Libraries/LibWeb/DOM/DOMImplementation.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2020, the SerenityOS developers. |
3 | | * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> |
4 | | * |
5 | | * SPDX-License-Identifier: BSD-2-Clause |
6 | | */ |
7 | | |
8 | | #pragma once |
9 | | |
10 | | #include <LibJS/Heap/GCPtr.h> |
11 | | #include <LibWeb/Bindings/PlatformObject.h> |
12 | | #include <LibWeb/DOM/Document.h> |
13 | | |
14 | | namespace Web::DOM { |
15 | | |
16 | | class DOMImplementation final : public Bindings::PlatformObject { |
17 | | WEB_PLATFORM_OBJECT(DOMImplementation, Bindings::PlatformObject); |
18 | | JS_DECLARE_ALLOCATOR(DOMImplementation); |
19 | | |
20 | | public: |
21 | | [[nodiscard]] static JS::NonnullGCPtr<DOMImplementation> create(Document&); |
22 | | virtual ~DOMImplementation(); |
23 | | |
24 | | WebIDL::ExceptionOr<JS::NonnullGCPtr<XMLDocument>> create_document(Optional<FlyString> const&, String const&, JS::GCPtr<DocumentType>) const; |
25 | | JS::NonnullGCPtr<Document> create_html_document(Optional<String> const& title) const; |
26 | | WebIDL::ExceptionOr<JS::NonnullGCPtr<DocumentType>> create_document_type(String const& qualified_name, String const& public_id, String const& system_id); |
27 | | |
28 | | // https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature |
29 | | bool has_feature() const |
30 | 0 | { |
31 | | // The hasFeature() method steps are to return true. |
32 | 0 | return true; |
33 | 0 | } |
34 | | |
35 | | private: |
36 | | explicit DOMImplementation(Document&); |
37 | | |
38 | | virtual void initialize(JS::Realm&) override; |
39 | | virtual void visit_edges(Cell::Visitor&) override; |
40 | | |
41 | 0 | Document& document() { return m_document; } |
42 | 0 | Document const& document() const { return m_document; } |
43 | | |
44 | | JS::NonnullGCPtr<Document> m_document; |
45 | | }; |
46 | | |
47 | | } |