mshtml: Added document fragment cloneNode implementation.

oldstable
Jacek Caban 2010-11-14 14:43:18 +01:00 committed by Alexandre Julliard
parent 5caf8c3187
commit a215ab64ff
2 changed files with 28 additions and 3 deletions

View File

@ -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);

View File

@ -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;