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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-collect-class-names.html

Issue 2296323002: DevTools: Add features to collect classnames from Stylesheets and DOM (Closed)
Patch Set: Created 4 years, 3 months 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
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script>
4 <script>
5
6 function test()
7 {
8 InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
9 InspectorTest.sendCommand("DOM.enable", {});
10 function onGotDocument(msg)
11 {
12 rootNodeId = msg.result.root.nodeId;
13 InspectorTest.sendCommandOrDie("DOM.collectClassNames", { nodeId: rootNo deId }, onClassNamesCollected);
14 }
15 function onClassNamesCollected(response)
lushnikov 2016/09/01 20:50:35 nit: let's have a line between functions
ahmetemirercin 2016/09/02 19:59:54 Done.
16 {
17
lushnikov 2016/09/01 20:50:35 nit: stray line
ahmetemirercin 2016/09/02 19:59:54 Done.
18 var classNames = response.classNames;
19 classNames.sort(function (a, b)
lushnikov 2016/09/01 20:50:35 doesn't the default comparator work good enough?
ahmetemirercin 2016/09/02 19:59:54 Done.
20 {
21 if (a < b)
22 return -1
23 if (a > b)
24 return 1;
25 return 0;
26 });
27 for(var i=0; i < classNames.length; i++)
28 InspectorTest.log(classNames[i]);
29
30 InspectorTest.completeTest();
31 }
32 }
33
34 </script>
35 </head>
36 <body onload="runTest()" class='body_class'>
37 <div class='class1'></div>
38 <div class='class2'>
39 <ul class='class3'>
lushnikov 2016/09/01 20:50:35 let's make sure it collects from shadow DOM as wel
ahmetemirercin 2016/09/02 19:59:54 Done.
40 <li class='class4'></li>
41 </ul>
42 </div>
43 <div class='class5 class6'></div>
44 </body>
45 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698