OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 WebInspector.DOMSyntaxHighlighter.prototype = { | 42 WebInspector.DOMSyntaxHighlighter.prototype = { |
43 /** | 43 /** |
44 * @param {string} content | 44 * @param {string} content |
45 * @param {string} className | 45 * @param {string} className |
46 * @return {!Element} | 46 * @return {!Element} |
47 */ | 47 */ |
48 createSpan: function(content, className) | 48 createSpan: function(content, className) |
49 { | 49 { |
50 var span = document.createElement("span"); | 50 var span = createElement("span"); |
51 span.className = "cm-" + className; | 51 span.className = "cm-" + className; |
52 if (this._stripExtraWhitespace && className !== "whitespace") | 52 if (this._stripExtraWhitespace && className !== "whitespace") |
53 content = content.replace(/^[\n\r]*/, "").replace(/\s*$/, ""); | 53 content = content.replace(/^[\n\r]*/, "").replace(/\s*$/, ""); |
54 span.createTextChild(content); | 54 span.createTextChild(content); |
55 return span; | 55 return span; |
56 }, | 56 }, |
57 | 57 |
58 /** | 58 /** |
59 * @param {!Element} node | 59 * @param {!Element} node |
60 */ | 60 */ |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 if (column > plainTextStart) { | 111 if (column > plainTextStart) { |
112 var plainText = line.substring(plainTextStart, column); | 112 var plainText = line.substring(plainTextStart, column); |
113 node.createTextChild(plainText); | 113 node.createTextChild(plainText); |
114 } | 114 } |
115 node.appendChild(this.createSpan(token, tokenType)); | 115 node.appendChild(this.createSpan(token, tokenType)); |
116 plainTextStart = newColumn; | 116 plainTextStart = newColumn; |
117 } | 117 } |
118 } | 118 } |
119 } | 119 } |
OLD | NEW |