2 <html xmlns=
"http://www.w3.org/1999/xhtml">
4 <script src=
"../../http/tests/inspector/inspector-test.js" id=
"script-id"></script>
5 <script src=
"../../http/tests/inspector/elements-test.js"></script>
6 <script id=
"test-script">
10 InspectorTest.expandElementsTree(dumpNodes.bind(null,
""));
13 function dumpNodes(prefix, node)
16 doc = getDocumentElement();
19 if (node.getAttribute(
"id") ===
"test-script")
21 dumpNodeData(node, prefix);
22 var children = node.children();
23 for (var i =
0; children && i < children.length; ++i)
24 dumpNodes(prefix +
" ", children[i]);
26 InspectorTest.completeTest();
29 function getDocumentElement()
31 var map = InspectorTest.domModel._idToDOMNode;
33 if (map[id].nodeName() ===
"#document")
40 function dumpNodeData(node, prefix)
42 var result = prefix +
"'" + node.nodeName() +
"':'" + node.nodeValue() +
"' - '" + WebInspector.DOMPresentationUtils.xPath(node, true) +
"'";
43 InspectorTest.addResult(result.replace(/\r?\n/g,
"\\n"));
59 <body onload=
"runTest()">
60 <p>Tests node xPath construction
</p>
62 <div id=
"id1" class=
"foo"></div>
63 <div id=
"id2" class=
"foo"></div>
66 <div id=
"id3" class=
"foo">3 Prefix <![CDATA[
<greeting>Hello, world!
</greeting>]]
> Suffix
</div>
67 <div id=
"id4" class=
"foo">4</div>
68 <div id=
"id5" class=
"foo">5</div>
69 <div id=
"id6" class=
"foo">6</div>