/src/serenity/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2020, the SerenityOS developers. |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/DOM/DocumentFragment.h> |
10 | | #include <LibWeb/HTML/HTMLElement.h> |
11 | | |
12 | | namespace Web::HTML { |
13 | | |
14 | | class HTMLTemplateElement final : public HTMLElement { |
15 | | WEB_PLATFORM_OBJECT(HTMLTemplateElement, HTMLElement); |
16 | | JS_DECLARE_ALLOCATOR(HTMLTemplateElement); |
17 | | |
18 | | public: |
19 | | virtual ~HTMLTemplateElement() override; |
20 | | |
21 | 0 | JS::NonnullGCPtr<DOM::DocumentFragment> content() { return *m_content; } |
22 | 0 | JS::NonnullGCPtr<DOM::DocumentFragment> const content() const { return *m_content; } |
23 | | |
24 | | void set_template_contents(JS::NonnullGCPtr<DOM::DocumentFragment>); |
25 | | |
26 | | virtual void adopted_from(DOM::Document&) override; |
27 | | virtual WebIDL::ExceptionOr<void> cloned(Node& copy, bool clone_children) override; |
28 | | |
29 | | private: |
30 | | HTMLTemplateElement(DOM::Document&, DOM::QualifiedName); |
31 | | |
32 | 0 | virtual bool is_html_template_element() const final { return true; } |
33 | | |
34 | | virtual void initialize(JS::Realm&) override; |
35 | | virtual void visit_edges(Cell::Visitor&) override; |
36 | | |
37 | | JS::GCPtr<DOM::DocumentFragment> m_content; |
38 | | }; |
39 | | |
40 | | } |
41 | | |
42 | | namespace Web::DOM { |
43 | | template<> |
44 | 0 | inline bool Node::fast_is<HTML::HTMLTemplateElement>() const { return is_html_template_element(); } |
45 | | } |