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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/css/css-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 type="text/javascript" src="../../http/tests/inspector-protocol/css-prot ocol-test.js"></script>
5 <script type="text/javascript" src="../../http/tests/inspector-protocol/dom-prot ocol-test.js"></script>
6 <script type="text/javascript">
7
8 function test()
9 {
10 var documentNodeId;
11 var addedStyleSheetCount = 0;
12 var styleSheetClasses = [];
13 InspectorTest.requestDocumentNodeId(onDocumentNodeId);
14 function onDocumentNodeId(nodeId)
15 {
16 InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded;
17 InspectorTest.sendCommandOrDie("CSS.enable", {});
18 }
19
20 function styleSheetAdded(response)
21 {
22 var styleSheetId = response.params.header.styleSheetId;
23 InspectorTest.sendCommandOrDie("CSS.collectClassNamesFromStyleSheet", { styleSheetId: styleSheetId }, onClassNamesCollected);
24 }
25
26 function finalizeTest()
27 {
28 styleSheetClasses.sort(function (a, b)
29 {
30 if (a < b)
lushnikov 2016/09/01 20:50:35 isn't default comparator good enough?
ahmetemirercin 2016/09/02 19:59:54 Done.
31 return -1
32 if (a > b)
33 return 1;
34 return 0;
35 });
36
37 for (var i = 0; i < styleSheetClasses.length; i++)
38 InspectorTest.log(styleSheetClasses[i]);
39 InspectorTest.completeTest();
40
41 }
42
43 function onClassNamesCollected(response)
44 {
45 var classNames = response.classNames;
46 for(var i=0; i < classNames.length; i++) {
lushnikov 2016/09/01 20:50:35 style: we don't put {} around one-line block
ahmetemirercin 2016/09/02 19:59:54 Done.
47 styleSheetClasses.push(classNames[i]);
48 }
49 if(++addedStyleSheetCount == 3)
50 finalizeTest();
51 }
52
lushnikov 2016/09/01 20:50:35 nit: stray line
ahmetemirercin 2016/09/02 19:59:54 Done.
53 };
54
55 window.addEventListener("DOMContentLoaded", function () {
56 runTest();
57 }, false);
58
59 </script>
60 <link rel="stylesheet" href="resources/collect-class-names.css"/>
61 <style>
62 .inline1{
63 font-size: 12px;
64 }
65 </style>
66 </head>
67 <body>
68 </body>
69 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698