2011-02-14 Pavel Feldman <pfeldman@chromium.org>
[WebKit-https.git] / LayoutTests / inspector / syntax-highlight.js
1 var initialize_SyntaxHighlight = function() {
2
3 InspectorTest.dumpSyntaxHighlight = function(str, mimeType)
4 {
5     var node = document.createElement("span");
6     node.textContent = str;
7     var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter(mimeType);
8     javascriptSyntaxHighlighter.syntaxHighlightNode(node);
9     var node_parts = [];
10     for (var i = 0; i < node.childNodes.length; i++) {
11         if (node.childNodes[i].getAttribute) {
12             node_parts.push(node.childNodes[i].getAttribute("class"));
13         } else {
14             node_parts.push("*");
15         }
16     }
17     InspectorTest.addResult(str + ": " + node_parts.join(","));
18 };
19
20 };