mshtml: Add IElementSelector::querySelector implementation.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4257a14f47
commit
394347945c
|
@ -5182,8 +5182,39 @@ static HRESULT WINAPI ElementSelector_Invoke(IElementSelector *iface, DISPID dis
|
|||
static HRESULT WINAPI ElementSelector_querySelector(IElementSelector *iface, BSTR v, IHTMLElement **pel)
|
||||
{
|
||||
HTMLElement *This = impl_from_IElementSelector(iface);
|
||||
FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
|
||||
return E_NOTIMPL;
|
||||
nsIDOMElement *nselem;
|
||||
HTMLElement *elem;
|
||||
nsAString nsstr;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
|
||||
|
||||
if(!This->dom_element) {
|
||||
FIXME("comment element\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
nsAString_InitDepend(&nsstr, v);
|
||||
nsres = nsIDOMElement_QuerySelector(This->dom_element, &nsstr, &nselem);
|
||||
nsAString_Finish(&nsstr);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("QuerySelector failed: %08x\n", nsres);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(!nselem) {
|
||||
*pel = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
hres = get_element(nselem, &elem);
|
||||
nsIDOMElement_Release(nselem);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
*pel = &elem->IHTMLElement_iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ElementSelector_querySelectorAll(IElementSelector *iface, BSTR v, IHTMLDOMChildrenCollection **pel)
|
||||
|
|
|
@ -200,12 +200,18 @@ function test_query_selector() {
|
|||
|
||||
var e = document.querySelector("nomatch");
|
||||
ok(e === null, "e = " + e);
|
||||
e = document.body.querySelector("nomatch");
|
||||
ok(e === null, "e = " + e);
|
||||
|
||||
e = document.querySelector(".class1");
|
||||
ok(e.tagName === "DIV", "e.tagName = " + e.tagName);
|
||||
e = document.body.querySelector(".class1");
|
||||
ok(e.tagName === "DIV", "e.tagName = " + e.tagName);
|
||||
|
||||
e = document.querySelector("a");
|
||||
ok(e.tagName === "A", "e.tagName = " + e.tagName);
|
||||
e = document.body.querySelector("a");
|
||||
ok(e.tagName === "A", "e.tagName = " + e.tagName);
|
||||
|
||||
next_test();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue