@@ -35,8 +35,7 @@ function numberLines(node, opt_startLineNum) {
3535 function walk ( node ) {
3636 switch ( node . nodeType ) {
3737 case 1 : // Element
38- if ( nocode . test ( node . className ) ) { console . log ( 'nocode' ) ; break ; }
39- console . log ( ' el=' + node . nodeName ) ;
38+ if ( nocode . test ( node . className ) ) { break ; }
4039 if ( 'BR' === node . nodeName ) {
4140 breakAfter ( node ) ;
4241 // Discard the <BR> since it is now flush against a </LI>.
@@ -57,7 +56,6 @@ console.log(' el=' + node.nodeName);
5756 var firstLine = text . substring ( 0 , match . index ) ;
5857 node . nodeValue = firstLine ;
5958 var tail = text . substring ( match . index + match [ 0 ] . length ) ;
60- console . log ( 'split "' + text . replace ( / \r \n ? | \n / g, '\\n' ) + '" into "' + firstLine + '" and "' + tail . replace ( / \r \n ? | \n / g, '\\n' ) + '"' ) ;
6159 if ( tail ) {
6260 var parent = node . parentNode ;
6361 parent . insertBefore (
@@ -109,19 +107,18 @@ console.log('split "' + text.replace(/\r\n?|\n/g, '\\n') + '" into "' + firstLin
109107 var copiedListItem = breakLeftOf ( lineEndNode . nextSibling , 0 ) ;
110108
111109 // Walk the parent chain until we reach an unattached LI.
110+ // Check nodeType since IE sticks useless document fragments around things.
112111 for ( var parent ; ( parent = copiedListItem . parentNode ) && parent . nodeType === 1 ; ) {
113112 copiedListItem = parent ;
114113 }
115114 // Put it on the list of lines for later processing.
116115 listItems . push ( copiedListItem ) ;
117- console . log ( 'pushing listItem length=' + listItems . length + ', copy=' + copiedListItem . nodeName ) ;
118116 }
119117
120118 // Split lines while there are lines left to split.
121119 for ( var i = 0 ; // Number of lines that have been split so far.
122120 i < listItems . length ; // length updated by breakAfter calls.
123121 ++ i ) {
124- console . log ( 'walking list item ' + i + ' : ' + listItems [ i ] . innerHTML . replace ( / [ \r \n ] + / , '\\n' ) ) ;
125122 walk ( listItems [ i ] ) ;
126123 }
127124
0 commit comments