Commit 06872bd8 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Implement lastElementChild for Elements.

parent 3388fecd
......@@ -6524,8 +6524,30 @@ static HRESULT WINAPI ElementTraversal_get_firstElementChild(IElementTraversal *
static HRESULT WINAPI ElementTraversal_get_lastElementChild(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_GetLastElementChild(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_previousElementSibling(IElementTraversal *iface, IHTMLElement **p)
......
......@@ -89,12 +89,15 @@ sync_test("textContent", function() {
sync_test("ElementTraversal", function() {
var div = document.createElement("div");
div.innerHTML = "abc<b>bold</b><script>/* */<script><div>text</div>def";
div.innerHTML = "abc<b>bold</b><script>/* */</script><div>text</div>def";
ok(div.firstElementChild.outerHTML === "<b>bold</b>",
"div.firstElementChild.outerHTML = " + div.firstElementChild.outerHTML);
ok(div.lastElementChild.outerHTML === "<div>text</div>",
"div.lastElementChild.outerHTML = " + div.lastElementChild.outerHTML);
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");
});
......
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