Rubber-stamped by Brady Eidson.
[webbrowser.git] / LayoutTests / inspector / syntax-highlight.js
blobe08073a33f3840acb4241615080cc358d1d6d124
1 // Inspected Page functions.
3 function doit()
5     function callback(result)
6     {
7         for (var i = 0; i < result.length; ++i)
8             output(result[i]);
9         notifyDone();
10     }
11     evaluateInWebInspector("frontend_doitAndDump", callback);
14 // Frontend functions.
16 function frontend_dumpSyntaxHighlight(str, highlighterConstructor)
18     var node = document.createElement("span");
19     node.textContent = str;
20     var javascriptSyntaxHighlighter = new highlighterConstructor(null, null);
21     javascriptSyntaxHighlighter.syntaxHighlightNode(node);
22     var node_parts = [];
23     for (var i = 0; i < node.childNodes.length; i++) {
24         if (node.childNodes[i].getAttribute) {
25             node_parts.push(node.childNodes[i].getAttribute("class"));
26         } else {
27             node_parts.push("*");
28         }
29     }
30     return node_parts.join(",");