Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: LayoutTests/inspector/elements/elements-css-path.html

Issue 75253002: DevTools: [Elements] Implement "Copy CSS Path" context menu item for elements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../http/tests/inspector/inspector-test.js" id="script-id"></scri pt>
5 <script src="../../http/tests/inspector/elements-test.js"></script>
6 <script id="test-script">
7 function test()
8 {
9 InspectorTest.expandElementsTree(dumpNodes.bind(null, ""));
10 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.
11
12 function dumpNodes(prefix, node)
13 {
14 if (!doc) {
15 doc = getDocumentElement();
16 node = doc;
17 }
18 if (node.getAttribute("id") === "test-script")
19 return;
20 if (node.nodeType() === Node.ELEMENT_NODE)
21 dumpNodeData(node, prefix);
22 var children = node.children();
23 for (var i = 0; children && i < children.length; ++i)
24 dumpNodes(prefix + " ", children[i]);
25 if (node === doc)
26 InspectorTest.completeTest();
27 }
28
29 function getDocumentElement()
30 {
31 var map = WebInspector.domAgent._idToDOMNode;
32 for (var id in map) {
33 if (map[id].nodeName() === "#document")
34 return map[id];
35 }
36
37 return null;
38 }
39
40 function dumpNodeData(node, prefix)
41 {
42 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
43 InspectorTest.addResult(result.replace(/\n/g, "\\n"));
44 }
45 }
46 </script>
47 </head>
48
49 <body onload="runTest()">
50 <p>Tests DOMNode.cssPath()</p>
51
52 <article>First</article>
53 <article>Second</article>
54
55 <div class="foo bar">1</div>
56 <div class="foo">2</div>
57 <span class="bar">3</span>
58
59 <div id="container">
60 <div>4</div>
61 <div>5</div>
62 <div id="inner-id">6</div>
63 <p>7</p>
64 </div>
65
66 </body>
67 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/elements/elements-css-path-expected.txt » ('j') | Source/devtools/front_end/DOMAgent.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698