Commit 41396b5b authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Implement querySelectorAll for document fragments.

parent 833286f4
......@@ -4762,8 +4762,18 @@ static HRESULT WINAPI DocumentSelector_querySelectorAll(IDocumentSelector *iface
TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
nsAString_InitDepend(&nsstr, v);
nsres = nsIDOMDocument_QuerySelectorAll(This->dom_document, &nsstr, &node_list);
if(This->dom_document)
nsres = nsIDOMDocument_QuerySelectorAll(This->dom_document, &nsstr, &node_list);
else {
nsIDOMDocumentFragment *frag;
nsres = nsIDOMNode_QueryInterface(This->node.nsnode, &IID_nsIDOMDocumentFragment, (void**)&frag);
if(NS_SUCCEEDED(nsres)) {
nsres = nsIDOMDocumentFragment_QuerySelectorAll(frag, &nsstr, &node_list);
nsIDOMDocumentFragment_Release(frag);
}
}
nsAString_Finish(&nsstr);
if(NS_FAILED(nsres)) {
WARN("QuerySelectorAll failed: %08lx\n", nsres);
return map_nsresult(nsres);
......
......@@ -285,6 +285,19 @@ sync_test("query_selector", function() {
ok(e.tagName === "A", "e.tagName = " + e.tagName);
e = frag.querySelector("a");
ok(e.tagName === "A", "e.tagName = " + e.tagName);
e = document.querySelectorAll(".class1");
ok(e.length === 3, "e.length = " + e.length);
e = document.body.querySelectorAll(".class1");
ok(e.length === 3, "e.length = " + e.length);
e = document.querySelectorAll(".class2");
ok(e.length === 1, "e.length = " + e.length);
e = document.body.querySelectorAll(".class2");
ok(e.length === 1, "e.length = " + e.length);
e = frag.querySelectorAll(".class3");
ok(e.length === 2, "e.length = " + e.length);
e = frag.querySelectorAll(".class4");
ok(e.length === 1, "e.length = " + e.length);
});
sync_test("compare_position", 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