diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 28059cce549..f0b705653c1 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1908,14 +1908,34 @@ static HRESULT HTMLDocumentNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HT
return E_NOTIMPL;
}
-#undef HTMLDOCNODE_NODE_THIS
-
static const NodeImplVtbl HTMLDocumentNodeImplVtbl = {
HTMLDocumentNode_QI,
HTMLDocumentNode_destructor,
HTMLDocumentNode_clone
};
+static HRESULT HTMLDocumentFragment_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
+{
+ HTMLDocumentNode *This = HTMLDOCNODE_NODE_THIS(iface);
+ HTMLDocumentNode *new_node;
+ HRESULT hres;
+
+ hres = create_document_fragment(nsnode, This->node.doc, &new_node);
+ if(FAILED(hres))
+ return hres;
+
+ *ret = &new_node->node;
+ return S_OK;
+}
+
+#undef HTMLDOCNODE_NODE_THIS
+
+static const NodeImplVtbl HTMLDocumentFragmentImplVtbl = {
+ HTMLDocumentNode_QI,
+ HTMLDocumentNode_destructor,
+ HTMLDocumentFragment_clone
+};
+
static const tid_t HTMLDocumentNode_iface_tids[] = {
IHTMLDOMNode_tid,
IHTMLDOMNode2_tid,
@@ -1998,7 +2018,7 @@ HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *doc_node,
return E_OUTOFMEMORY;
HTMLDOMNode_Init(doc_node, &doc_frag->node, nsnode);
- doc_frag->node.vtbl = &HTMLDocumentNodeImplVtbl;
+ doc_frag->node.vtbl = &HTMLDocumentFragmentImplVtbl;
doc_frag->node.cp_container = &doc_frag->basedoc.cp_container;
htmldoc_addref(&doc_frag->basedoc);
diff --git a/dlls/mshtml/tests/jstest.html b/dlls/mshtml/tests/jstest.html
index ae224ccb32a..39f262080f9 100644
--- a/dlls/mshtml/tests/jstest.html
+++ b/dlls/mshtml/tests/jstest.html
@@ -38,6 +38,11 @@ function test_createDocumentFragment() {
ok(fragment.parentWindow === window, "fragment.parentWindow != window");
ok(fragment.nodeType === 11, "fragment.nodeType = " + fragment.nodeType);
ok(fragment.nodeName === "#document-fragment", "fragment.nodeName = " + fragment.nodeName);
+
+ var cloned = fragment.cloneNode(true);
+ ok(cloned.parentWindow === window, "cloned.parentWindow != window");
+ ok(cloned.nodeType === 11, "cloned.nodeType = " + cloned.nodeType);
+ ok(cloned.nodeName === "#document-fragment", "cloned.nodeName = " + cloned.nodeName);
}
var globalVar = false;