Index: LayoutTests/inspector/elements/elements-css-path.html |
diff --git a/LayoutTests/inspector/elements/elements-css-path.html b/LayoutTests/inspector/elements/elements-css-path.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6d8bbbab0206249fc3f6658afb66d7429dde36c3 |
--- /dev/null |
+++ b/LayoutTests/inspector/elements/elements-css-path.html |
@@ -0,0 +1,67 @@ |
+<!DOCTYPE html> |
+<html> |
+<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"> |
+function test() |
+{ |
+ InspectorTest.expandElementsTree(dumpNodes.bind(null, "")); |
+ var doc; |
aandrey
2013/11/18 13:43:51
make this a local var of the function below
apavlov
2013/11/18 15:03:59
Done.
|
+ |
+ function dumpNodes(prefix, node) |
+ { |
+ if (!doc) { |
+ doc = getDocumentElement(); |
+ node = doc; |
+ } |
+ if (node.getAttribute("id") === "test-script") |
+ return; |
+ if (node.nodeType() === Node.ELEMENT_NODE) |
+ 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.cssPath(true); |
aandrey
2013/11/18 13:43:51
can you also test that:
(document.querySelectorAl
apavlov
2013/11/18 15:03:59
This condition is too weak. We should test that th
|
+ InspectorTest.addResult(result.replace(/\n/g, "\\n")); |
+ } |
+} |
+</script> |
+</head> |
+ |
+<body onload="runTest()"> |
+<p>Tests DOMNode.cssPath()</p> |
+ |
+<article>First</article> |
+<article>Second</article> |
+ |
+<div class="foo bar">1</div> |
+<div class="foo">2</div> |
+<span class="bar">3</span> |
+ |
+<div id="container"> |
+ <div>4</div> |
+ <div>5</div> |
+ <div id="inner-id">6</div> |
+ <p>7</p> |
+</div> |
+ |
+</body> |
+</html> |