diff --git a/Libraries/LibHTML/DOM/DocumentFragment.h b/Libraries/LibHTML/DOM/DocumentFragment.h new file mode 100644 index 0000000000..2324f73ff5 --- /dev/null +++ b/Libraries/LibHTML/DOM/DocumentFragment.h @@ -0,0 +1,19 @@ +#pragma once + +#include + +class DocumentFragment : public ParentNode { +public: + DocumentFragment(Document& document) + : ParentNode(document, NodeType::DOCUMENT_FRAGMENT_NODE) + { + } + + virtual String tag_name() const override { return "#document-fragment"; } +}; + +template<> +inline bool is(const Node& node) +{ + return node.is_document_fragment(); +} diff --git a/Libraries/LibHTML/DOM/Node.h b/Libraries/LibHTML/DOM/Node.h index 70d31fb606..b0e5bdd952 100644 --- a/Libraries/LibHTML/DOM/Node.h +++ b/Libraries/LibHTML/DOM/Node.h @@ -13,6 +13,7 @@ enum class NodeType : unsigned { COMMENT_NODE = 8, DOCUMENT_NODE = 9, DOCUMENT_TYPE_NODE = 10, + DOCUMENT_FRAGMENT_NODE = 11, }; class Document; @@ -35,6 +36,7 @@ public: bool is_document_type() const { return type() == NodeType::DOCUMENT_TYPE_NODE; } bool is_comment() const { return type() == NodeType::COMMENT_NODE; } bool is_character_data() const { return type() == NodeType::TEXT_NODE || type() == NodeType::COMMENT_NODE; } + bool is_document_fragment() const { return type() == NodeType::DOCUMENT_FRAGMENT_NODE; } bool is_parent_node() const { return is_element() || is_document(); } virtual RefPtr create_layout_node(const StyleProperties* parent_style) const;