| <!-- Pre-comment --> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <script src="../../http/tests/inspector/inspector-test.js" id="script-id"></script> |
| <script src="../../http/tests/inspector/elements-test.js"></script> |
| <script id="test-script"> |
| //<![CDATA[ |
| function test() |
| { |
| InspectorTest.expandElementsTree(dumpNodes.bind(null, "")); |
| var doc; |
| |
| function dumpNodes(prefix, node) |
| { |
| if (!doc) { |
| doc = getDocumentElement(); |
| node = doc; |
| } |
| if (node.getAttribute("id") === "test-script") |
| return; |
| dumpNodeData(node, prefix); |
| var children = node.children; |
| for (var i = 0; children && i < children.length; ++i) |
| dumpNodes(prefix + " ", children[i]); |
| if (node === doc) |
| InspectorTest.completeTest(); |
| } |
| |
| function getDocumentElement() |
| { |
| var map = WebInspector.domAgent._idToDOMNode; |
| for (var id in map) { |
| if (map[id].nodeName() === "#document") |
| return map[id]; |
| } |
| |
| return null; |
| } |
| |
| function dumpNodeData(node, prefix) |
| { |
| var result = prefix + "'" + node.nodeName() + "':'" + node.nodeValue() + "' - '" + node.xPath(true) + "'"; |
| InspectorTest.addResult(result.replace(/\n/g, "\\n")); |
| } |
| } |
| //]]> |
| </script> |
| <script> |
| // Comment |
| //<![CDATA[ |
| function f() |
| { |
| document.write("<"); |
| } |
| //]]> |
| </script> |
| </head> |
| |
| <body onload="runTest()"> |
| <p>Tests DOMNode.xPath()</p> |
| |
| <div id="id1" class="foo"></div> |
| <div id="id2" class="foo"></div> |
| |
| <div id="container"> |
| <div id="id3" class="foo">3 Prefix <![CDATA[<greeting>Hello, world!</greeting>]]> Suffix</div> |
| <div id="id4" class="foo">4</div> |
| <div id="id5" class="foo">5</div> |
| <div id="id6" class="foo">6</div> |
| </div> |
| |
| </body> |
| </html> |
| <!-- Post-comment --> |