Commit a215ab64 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added document fragment cloneNode implementation.

parent 5caf8c31
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment