Skip to content

Commit

Permalink
Simplify 53bc4b1
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed May 4, 2013
1 parent 53bc4b1 commit 64113ec
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions addon/runmode/runmode.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CodeMirror.runMode = function(string, modespec, callback, options) {
var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
var isIe8OrEarlier = /\bMSIE\s(\d+)/.exec(navigator.userAgent);
isIe8OrEarlier = isIe8OrEarlier && +isIe8OrEarlier[1] <= 8;
var ie = /MSIE \d/.test(navigator.userAgent);
var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);

if (callback.nodeType == 1) {
var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
Expand All @@ -11,9 +11,7 @@ CodeMirror.runMode = function(string, modespec, callback, options) {
if (text == "\n") {
// Emitting LF or CRLF on IE8 or earlier results in an incorrect display.
// Emitting a carriage return makes everything ok.
var newLine = isIe8OrEarlier ? '\r' : text;
var newLineSpan = node.appendChild(document.createElement("span"));
newLineSpan.appendChild( document.createTextNode(newLine));
node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text));
col = 0;
return;
}
Expand Down

0 comments on commit 64113ec

Please sign in to comment.