Commit 107f318e authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard
Browse files

mshtml: Implement previousElementSibling for Elements.



Signed-off-by: Gabriel Ivăncescu's avatarGabriel Ivăncescu <gabrielopcode@gmail.com>
parent 67f182bf
...@@ -6553,8 +6553,30 @@ static HRESULT WINAPI ElementTraversal_get_lastElementChild(IElementTraversal *i ...@@ -6553,8 +6553,30 @@ static HRESULT WINAPI ElementTraversal_get_lastElementChild(IElementTraversal *i
static HRESULT WINAPI ElementTraversal_get_previousElementSibling(IElementTraversal *iface, IHTMLElement **p) static HRESULT WINAPI ElementTraversal_get_previousElementSibling(IElementTraversal *iface, IHTMLElement **p)
{ {
HTMLElement *This = impl_from_IElementTraversal(iface); HTMLElement *This = impl_from_IElementTraversal(iface);
FIXME("(%p)->(%p)\n", This, p); nsIDOMElement *nselem = NULL;
return E_NOTIMPL; HTMLElement *elem;
HRESULT hres;
TRACE("(%p)->(%p)\n", This, p);
if(!This->dom_element) {
*p = NULL;
return S_OK;
}
nsIDOMElement_GetPreviousElementSibling(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_nextElementSibling(IElementTraversal *iface, IHTMLElement **p) static HRESULT WINAPI ElementTraversal_get_nextElementSibling(IElementTraversal *iface, IHTMLElement **p)
......
...@@ -98,6 +98,10 @@ sync_test("ElementTraversal", function() { ...@@ -98,6 +98,10 @@ sync_test("ElementTraversal", function() {
"div.firstElementChild.nextElementSibling.outerHTML = " + div.firstElementChild.nextElementSibling.outerHTML); "div.firstElementChild.nextElementSibling.outerHTML = " + div.firstElementChild.nextElementSibling.outerHTML);
ok(div.lastElementChild.nextElementSibling === null, ok(div.lastElementChild.nextElementSibling === null,
"div.lastElementChild.nextElementSibling = " + div.lastElementChild.nextElementSibling); "div.lastElementChild.nextElementSibling = " + div.lastElementChild.nextElementSibling);
ok(div.lastElementChild.previousElementSibling.outerHTML === "<script>/* */</script>",
"div.lastElementChild.previousElementSibling.outerHTML = " + div.lastElementChild.previousElementSibling.outerHTML);
ok(div.firstElementChild.previousElementSibling === null,
"div.firstElementChild.previousElementSibling = " + div.firstElementChild.previousElementSibling);
div.innerHTML = "abc"; div.innerHTML = "abc";
ok(div.firstElementChild === null, "div.firstElementChild = " + div.firstElementChild); ok(div.firstElementChild === null, "div.firstElementChild = " + div.firstElementChild);
......
Supports Markdown
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