4 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
5 <script src=
"../../http/tests/inspector/elements-test.js"></script>
10 InspectorTest
.selectNodeWithId("container", step1
);
14 var containerId
= node
.id
;
15 var documentId
= node
.ownerDocument
.id
;
17 InspectorTest
.runTestSuite([
18 function testDocumentQuerySelector(next
)
20 InspectorTest
.DOMAgent
.querySelector(documentId
, "div.foo", dumpNodes
.bind(null, next
));
23 function testDocumentQuerySelectorAll(next
)
25 InspectorTest
.DOMAgent
.querySelectorAll(documentId
, "div.foo", dumpNodes
.bind(null, next
));
28 function testQuerySelector(next
)
30 InspectorTest
.DOMAgent
.querySelector(containerId
, "div.foo", dumpNodes
.bind(null, next
));
33 function testQuerySelectorAll(next
)
35 InspectorTest
.DOMAgent
.querySelectorAll(containerId
, "div.foo", dumpNodes
.bind(null, next
));
40 function dumpNodes(next
, error
, nodeIds
)
43 InspectorTest
.addResult(error
);
48 if (!(nodeIds
&& nodeIds
.constructor && nodeIds
.constructor.name
=== "Array"))
51 for (var i
= 0; i
< nodeIds
.length
; ++i
) {
53 InspectorTest
.addResult("no results");
55 var node
= InspectorTest
.domModel
.nodeForId(nodeIds
[i
]);
56 InspectorTest
.addResult("node id: " + node
.getAttribute("id"));
65 <body onload=
"runTest()">
67 Tests DOMAgent.querySelector and DOMAgent.querySelectorAll.
70 <div id=
"id1" class=
"foo"></div>
71 <div id=
"id2" class=
"foo"></div>
74 <div id=
"id3" class=
"foo"></div>
75 <div id=
"id4" class=
"foo"></div>
76 <div id=
"id5" class=
"foo"></div>
77 <div id=
"id6" class=
"foo"></div>