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

mshtml: Added IHTMLDOMTextNode::splitText implementation.

parent 998d3464
......@@ -152,8 +152,31 @@ static HRESULT WINAPI HTMLDOMTextNode_get_length(IHTMLDOMTextNode *iface, LONG *
static HRESULT WINAPI HTMLDOMTextNode_splitText(IHTMLDOMTextNode *iface, LONG offset, IHTMLDOMNode **pRetNode)
{
HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface);
FIXME("(%p)->(%d %p)\n", This, offset, pRetNode);
return E_NOTIMPL;
HTMLDOMNode *node;
nsIDOMText *text;
nsresult nsres;
HRESULT hres;
TRACE("(%p)->(%d %p)\n", This, offset, pRetNode);
nsres = nsIDOMText_SplitText(This->nstext, offset, &text);
if(NS_FAILED(nsres)) {
ERR("SplitText failed: %x08x\n", nsres);
return E_FAIL;
}
if(!text) {
*pRetNode = NULL;
return S_OK;
}
hres = get_node(This->node.doc, (nsIDOMNode*)text, TRUE, &node);
nsIDOMText_Release(text);
if(FAILED(hres))
return hres;
*pRetNode = &node->IHTMLDOMNode_iface;
return S_OK;
}
static const IHTMLDOMTextNodeVtbl HTMLDOMTextNodeVtbl = {
......
......@@ -339,6 +339,21 @@ function test_language_attribute() {
ok(elem.language === "1", "elem.language = " + elem.language);
}
function test_text_node() {
document.body.innerHTML = 'testing text';
var text = document.body.childNodes[0], text2;
ok(text.data == "testing text", "text.data = " + text.data);
text2 = text.splitText(7);
ok(text.data == "testing", "text.data = " + text.data);
ok(text2.data == " text", "text2.data = " + text2.data);
ok(text.nextSibling === text2, "text.nextSibling !== text2");
text2 = text.splitText(0);
ok(text.data == "", "text.data = " + text.data);
ok(text2.data == "testing", "text2.data = " + text2.data);
}
var globalVar = false;
function runTests() {
......@@ -363,6 +378,7 @@ function runTests() {
test_customtag();
test_whitespace_nodes();
test_language_attribute();
test_text_node();
var r = window.execScript("globalVar = true;");
ok(r === undefined, "execScript returned " + r);
......
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