summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke <luke.wilde@live.co.uk>2021-07-05 05:21:52 +0100
committerAndreas Kling <kling@serenityos.org>2021-07-05 12:39:46 +0200
commit5430bc896316c1cd8702b8f32bfc16c68cd407e6 (patch)
tree319f6992e03190682af39f51529e9f62b0c13a20
parentf7ad8c0f94af4d42e669d8f3fa9af51a46e30cbb (diff)
downloadserenity-5430bc896316c1cd8702b8f32bfc16c68cd407e6.zip
LibWeb: Make clone_node capable of cloning document fragments
Used by Web Components Polyfills.
-rw-r--r--Userland/Libraries/LibWeb/DOM/Node.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp
index 8ec7179a40..c90dcadf98 100644
--- a/Userland/Libraries/LibWeb/DOM/Node.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Node.cpp
@@ -446,6 +446,9 @@ NonnullRefPtr<Node> Node::clone_node(Document* document, bool clone_children) co
auto processing_instruction = verify_cast<ProcessingInstruction>(this);
auto processing_instruction_copy = adopt_ref(*new ProcessingInstruction(*document, processing_instruction->data(), processing_instruction->target()));
copy = move(processing_instruction_copy);
+ } else if (is<DocumentFragment>(this)) {
+ auto document_fragment_copy = adopt_ref(*new DocumentFragment(*document));
+ copy = move(document_fragment_copy);
} else {
dbgln("clone_node() not implemented for NodeType {}", (u16)m_type);
TODO();