summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/inspector/syntax-highlight.js
blob: cb3ea7aaad0ed077535f1599c2f44649b6e8b2f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var initialize_SyntaxHighlight = function() {

InspectorTest.dumpSyntaxHighlight = function(str, mimeType)
{
    var node = document.createElement("span");
    node.textContent = str;
    var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter(mimeType);
    javascriptSyntaxHighlighter.syntaxHighlightNode(node);
    var node_parts = [];
    for (var i = 0; i < node.childNodes.length; i++) {
        if (node.childNodes[i].getAttribute) {
            node_parts.push(node.childNodes[i].getAttribute("class"));
        } else {
            node_parts.push("*");
        }
    }
    InspectorTest.addResult(str + ": " + node_parts.join(","));
};

};