Changeset 1032

Show
Ignore:
Timestamp:
2007-10-17 07:53:13 (2 years ago)
Author:
martinkou
Message:

Fixed #1414: Merged Fred's simpler solution to the bug.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/_source/internals/fckxhtml.js

    r1025 r1032  
    378378        pre : function ( node, htmlNode ) 
    379379        { 
    380                 for ( var i = 0 ; i < htmlNode.childNodes.length ; i++ ) 
    381                 { 
    382                         var item = htmlNode.childNodes[i] ; 
    383                         var val = item.nodeValue ; 
    384                         if ( item.nodeType == 3 && i == 0 ) 
    385                         { 
    386                                 // We shouldn't put the plain text value of the text node directly into HTML. (See #1414) 
    387                                 var dummyNode = document.createElement( 'pre' ) ; 
    388                                 dummyNode.appendChild( document.createTextNode( val ) ) ; 
    389                                 node.appendChild( FCKXHtml.XML.createTextNode( FCKXHtml._AppendSpecialItem( '\r\n' + dummyNode.innerHTML ) ) ) ; 
    390                         } 
    391                         else 
    392                                 FCKXHtml._AppendNode( node, item ) ; 
    393                 } 
     380                var firstChild = htmlNode.firstChild ; 
     381 
     382                if ( firstChild && firstChild.nodeType == 3 ) 
     383                        node.appendChild( FCKXHtml.XML.createTextNode( FCKXHtml._AppendSpecialItem( '\r\n' ) ) ) ; 
     384 
     385                FCKXHtml._AppendChildNodes( node, htmlNode, true ) ; 
     386 
    394387                return node ; 
    395388        },