Commit 67f182bf authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Implement nextElementSibling for Elements.

parent 06872bd8
......@@ -6560,8 +6560,30 @@ static HRESULT WINAPI ElementTraversal_get_previousElementSibling(IElementTraver
static HRESULT WINAPI ElementTraversal_get_nextElementSibling(IElementTraversal *iface, IHTMLElement **p)
{
HTMLElement *This = impl_from_IElementTraversal(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsIDOMElement *nselem = NULL;
HTMLElement *elem;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, p);
if(!This->dom_element) {
*p = NULL;
return S_OK;
}
nsIDOMElement_GetNextElementSibling(This->dom_element, &nselem);
if(!nselem) {
*p = NULL;
return S_OK;
}
hres = get_element(nselem, &elem);
nsIDOMElement_Release(nselem);
if(FAILED(hres))
return hres;
*p = &elem->IHTMLElement_iface;
return S_OK;
}
static HRESULT WINAPI ElementTraversal_get_childElementCount(IElementTraversal *iface, LONG *p)
......
......@@ -94,12 +94,17 @@ sync_test("ElementTraversal", function() {
"div.firstElementChild.outerHTML = " + div.firstElementChild.outerHTML);
ok(div.lastElementChild.outerHTML === "<div>text</div>",
"div.lastElementChild.outerHTML = " + div.lastElementChild.outerHTML);
ok(div.firstElementChild.nextElementSibling.outerHTML === "<script>/* */</script>",
"div.firstElementChild.nextElementSibling.outerHTML = " + div.firstElementChild.nextElementSibling.outerHTML);
ok(div.lastElementChild.nextElementSibling === null,
"div.lastElementChild.nextElementSibling = " + div.lastElementChild.nextElementSibling);
div.innerHTML = "abc";
ok(div.firstElementChild === null, "div.firstElementChild = " + div.firstElementChild);
ok(div.lastElementChild === null, "div.lastElementChild = " + div.lastElementChild);
ok(!("firstElementChild" in document), "firstElementChild found in document");
ok(!("nextElementSibling" in document), "nextElementSibling found in document");
});
sync_test("head", function() {
......
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