@@ -1077,6 +1077,21 @@ window['_pr_isIE6'] = function () {
10771077 var trailingSpaceRe = / [ \r \n ] $ / ;
10781078 var lastWasSpace = true ; // the last text chunk emitted ended with a space.
10791079
1080+ // See bug 71 and http://stackoverflow.com/questions/136443/why-doesnt-ie7-
1081+ var isIE678 = window [ '_pr_isIE6' ] ( ) ;
1082+ var lineBreakHtml = (
1083+ isIE678
1084+ ? ( job . sourceNode . tagName === 'PRE'
1085+ // Use line feeds instead of <br>s so that copying and pasting works
1086+ // on IE.
1087+ // Doing this on other browsers breaks lots of stuff since \r\n is
1088+ // treated as two newlines on Firefox.
1089+ ? ( isIE678 === 6 ? ' \r\n' : ' \r' )
1090+ // IE collapses multiple adjacient <br>s into 1 line break.
1091+ // Prefix every newline with ' ' to prevent such behavior.
1092+ : ' <br />' )
1093+ : '<br />' ) ;
1094+
10801095 // A helper function that is responsible for opening sections of decoration
10811096 // and outputing properly escaped chunks of source
10821097 function emitTextUpTo ( sourceIdx ) {
@@ -1105,9 +1120,6 @@ window['_pr_isIE6'] = function () {
11051120 // Keep track of whether we need to escape space at the beginning of the
11061121 // next chunk.
11071122 lastWasSpace = trailingSpaceRe . test ( htmlChunk ) ;
1108- // IE collapses multiple adjacient <br>s into 1 line break.
1109- // Prefix every <br> with ' ' can prevent such IE's behavior.
1110- var lineBreakHtml = window [ '_pr_isIE6' ] ( ) ? ' <br />' : '<br />' ;
11111123 html . push ( htmlChunk . replace ( newlineRe , lineBreakHtml ) ) ;
11121124 outputIdx = sourceIdx ;
11131125 }
@@ -1326,10 +1338,6 @@ window['_pr_isIE6'] = function () {
13261338 }
13271339
13281340 function prettyPrint ( opt_whenDone ) {
1329- var isIE678 = window [ '_pr_isIE6' ] ( ) ;
1330- var ieNewline = isIE678 === 6 ? '\r\n' : '\r' ;
1331- // See bug 71 and http://stackoverflow.com/questions/136443/why-doesnt-ie7-
1332-
13331341 // fetch a list of nodes to rewrite
13341342 var codeSegments = [
13351343 document . getElementsByTagName ( 'pre' ) ,
@@ -1434,20 +1442,6 @@ window['_pr_isIE6'] = function () {
14341442 cs . parentNode . replaceChild ( pre , cs ) ;
14351443 cs = pre ;
14361444 }
1437-
1438- // Replace <br>s with line-feeds so that copying and pasting works
1439- // on IE 6.
1440- // Doing this on other browsers breaks lots of stuff since \r\n is
1441- // treated as two newlines on Firefox, and doing this also slows
1442- // down rendering.
1443- if ( isIE678 && cs . tagName === 'PRE' ) {
1444- var lineBreaks = cs . getElementsByTagName ( 'br' ) ;
1445- for ( var j = lineBreaks . length ; -- j >= 0 ; ) {
1446- var lineBreak = lineBreaks [ j ] ;
1447- lineBreak . parentNode . replaceChild (
1448- document . createTextNode ( ieNewline ) , lineBreak ) ;
1449- }
1450- }
14511445 }
14521446
14531447 doWork ( ) ;
0 commit comments