diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index ae31d1d14d1..927541bd4e7 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -4953,8 +4953,25 @@ static HRESULT WINAPI ElementTraversal_Invoke(IElementTraversal *iface, DISPID d static HRESULT WINAPI ElementTraversal_get_firstElementChild(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); + + nsIDOMHTMLElement_GetFirstElementChild(This->nselem, &nselem); + if(!nselem) { + *p = NULL; + return S_OK; + } + + hres = get_elem(This->node.doc, nselem, &elem); + nsIDOMElement_Release(nselem); + if(FAILED(hres)) + return hres; + + *p = &elem->IHTMLElement_iface; + return S_OK; } static HRESULT WINAPI ElementTraversal_get_lastElementChild(IElementTraversal *iface, IHTMLElement **p) diff --git a/dlls/mshtml/tests/elements.js b/dlls/mshtml/tests/elements.js index 4167e32c547..b7db0bc54d2 100644 --- a/dlls/mshtml/tests/elements.js +++ b/dlls/mshtml/tests/elements.js @@ -80,7 +80,22 @@ function test_textContent() { next_test(); } +function test_ElementTraversal() { + var div = document.createElement("div"); + div.innerHTML = "abcbold