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

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: Tentatively fix xpath test on Windows bot 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
« no previous file with comments | « no previous file | LayoutTests/inspector/elements/elements-css-path-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <script src="../../http/tests/inspector/inspector-test.js" id="script-id"></scri pt>
6 <script src="../../http/tests/inspector/elements-test.js"></script>
7 <script id="test-script">
8 function matchingElements(selector)
9 {
10 return document.querySelectorAll(selector).length;
11 }
12
13 function test()
14 {
15 var nodeQueue = [];
16 InspectorTest.expandElementsTree(enqueueNodes);
17
18 function enqueueNodes()
19 {
20 enqueueNode("", getDocumentElement());
21 dumpNodeData();
22 }
23
24 function dumpNodeData()
25 {
26 var entry = nodeQueue.shift();
27 if (!entry) {
28 InspectorTest.completeTest();
29 return;
30 }
31 var cssPath = WebInspector.DOMPresentationUtils.cssPath(entry.node, true );
32 var result = entry.prefix + cssPath;
33 InspectorTest.addResult(result.replace(/\n/g, "\\n"));
34 var escapedPath = cssPath.replace(/\\/g, "\\\\");
35 InspectorTest.evaluateInPage("matchingElements('" + escapedPath + "')", callback);
36
37 function callback(result)
38 {
39 InspectorTest.assertEquals(1, result.value);
40 dumpNodeData();
41 }
42 }
43
44 function getDocumentElement()
45 {
46 var map = WebInspector.domAgent._idToDOMNode;
47 for (var id in map) {
48 if (map[id].nodeName() === "#document")
49 return map[id];
50 }
51
52 return null;
53 }
54
55 function enqueueNode(prefix, node)
56 {
57 if (node.nodeType() === Node.ELEMENT_NODE)
58 nodeQueue.push({prefix: prefix, node: node});
59 var children = node.children();
60 for (var i = 0; children && i < children.length; ++i)
61 enqueueNode(prefix + " ", children[i]);
62 }
63
64 }
65 </script>
66 </head>
67
68 <body onload="runTest()">
69 <p>Tests DOMNode.cssPath()</p>
70
71 <article></article>
72 <article></article>
73
74 <div id="ids">
75 <div></div>
76 <div></div>
77 <div id="inner-id"></div>
78 <div id="__proto__"></div>
79 <div id='#"ridiculous".id'></div>
80 <div id="'quoted.value'"></div>
81 <div id=".foo.bar"></div>
82 <div id="-"></div>
83 <div id="-a"></div>
84 <div id="-0"></div>
85 <div id="7"></div>
86 <div id="ид">ид</div>
87 <p></p>
88 </div>
89
90 <div id="classes">
91 <div class="foo bar"></div>
92 <div class=" foo foo "></div>
93 <div class=".foo"></div>
94 <div class=".foo.bar"></div>
95 <div class="-"></div>
96 <div class="-a"></div>
97 <div class="-0"></div>
98 <div class="7"></div>
99 <div class="класс">класс</div>
100 <div class="__proto__"></div>
101 <div class="__proto__ foo"></div>
102 <span class="bar"></span>
103 <div id="id-with-class" class="moo"></div>
104 </div>
105
106 <div id="non-unique-classes">
107 <span class="c1"></span>
108 <span class="c1"></span>
109 <span class="c1 c2"></span>
110 <span class="c1 c2 c3"></span>
111 <span></span>
112 <div class="c1"></div>
113 <div class="c1 c2"></div>
114 <div class="c3 c2"></div>
115 <div class="c3 c4"></div>
116 <div class="c1 c4"></div>
117 <div></div>
118 </div>
119 </body>
120 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/elements/elements-css-path-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698