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

Unified 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, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-collect-class-names.html
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-collect-class-names.html b/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-collect-class-names.html
new file mode 100644
index 0000000000000000000000000000000000000000..284de91c51c90cd14c6d74acff79c0d9078ee267
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/dom/dom-collect-class-names.html
@@ -0,0 +1,45 @@
+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
+<script>
+
+function test()
+{
+ InspectorTest.sendCommand("DOM.getDocument", {}, onGotDocument);
+ InspectorTest.sendCommand("DOM.enable", {});
+ function onGotDocument(msg)
+ {
+ rootNodeId = msg.result.root.nodeId;
+ InspectorTest.sendCommandOrDie("DOM.collectClassNames", { nodeId: rootNodeId }, onClassNamesCollected);
+ }
+ 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.
+ {
+
lushnikov 2016/09/01 20:50:35 nit: stray line
ahmetemirercin 2016/09/02 19:59:54 Done.
+ var classNames = response.classNames;
+ 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.
+ {
+ if (a < b)
+ return -1
+ if (a > b)
+ return 1;
+ return 0;
+ });
+ for(var i=0; i < classNames.length; i++)
+ InspectorTest.log(classNames[i]);
+
+ InspectorTest.completeTest();
+ }
+}
+
+</script>
+</head>
+<body onload="runTest()" class='body_class'>
+<div class='class1'></div>
+<div class='class2'>
+ <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.
+ <li class='class4'></li>
+ </ul>
+</div>
+<div class='class5 class6'></div>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698