2020-08-01 03:07:00 +01:00
|
|
|
/*
|
2021-04-28 22:46:44 +02:00
|
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
2020-08-01 03:07:00 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-08-01 03:07:00 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-08-19 22:30:33 +01:00
|
|
|
#include <LibWeb/DOM/DocumentFragment.h>
|
2020-08-01 03:07:00 +01:00
|
|
|
#include <LibWeb/HTML/HTMLElement.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
class HTMLTemplateElement final : public HTMLElement {
|
2022-08-28 13:42:07 +02:00
|
|
|
WEB_PLATFORM_OBJECT(HTMLTemplateElement, HTMLElement);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(HTMLTemplateElement);
|
2020-08-01 03:07:00 +01:00
|
|
|
|
2022-08-28 13:42:07 +02:00
|
|
|
public:
|
2020-08-01 03:07:00 +01:00
|
|
|
virtual ~HTMLTemplateElement() override;
|
2020-08-19 22:30:33 +01:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<DOM::DocumentFragment> content() { return *m_content; }
|
|
|
|
GC::Ref<DOM::DocumentFragment> const content() const { return *m_content; }
|
2020-08-19 22:30:33 +01:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
void set_template_contents(GC::Ref<DOM::DocumentFragment>);
|
2024-06-25 09:43:50 +02:00
|
|
|
|
2021-07-05 05:40:47 +01:00
|
|
|
virtual void adopted_from(DOM::Document&) override;
|
2025-01-11 17:37:08 +00:00
|
|
|
virtual WebIDL::ExceptionOr<void> cloned(Node& copy, bool clone_children) const override;
|
2021-07-05 05:40:07 +01:00
|
|
|
|
2020-08-19 22:30:33 +01:00
|
|
|
private:
|
2022-08-28 13:42:07 +02:00
|
|
|
HTMLTemplateElement(DOM::Document&, DOM::QualifiedName);
|
|
|
|
|
2021-09-16 00:52:10 +02:00
|
|
|
virtual bool is_html_template_element() const final { return true; }
|
|
|
|
|
2023-08-07 08:41:28 +02:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2022-10-29 13:06:24 +02:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
2020-08-19 22:30:33 +01:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<DOM::DocumentFragment> m_content;
|
2020-08-01 03:07:00 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2021-09-16 00:52:10 +02:00
|
|
|
|
|
|
|
namespace Web::DOM {
|
2025-05-13 07:06:33 -04:00
|
|
|
|
2021-09-16 00:52:10 +02:00
|
|
|
template<>
|
|
|
|
inline bool Node::fast_is<HTML::HTMLTemplateElement>() const { return is_html_template_element(); }
|
2025-05-13 07:06:33 -04:00
|
|
|
|
2021-09-16 00:52:10 +02:00
|
|
|
}
|