浏览代码

LibWeb: Make clone_node capable of cloning document fragments

Used by Web Components Polyfills.
Luke 4 年之前
父节点
当前提交
5430bc8963
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      Userland/Libraries/LibWeb/DOM/Node.cpp

+ 3 - 0
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();