Ticket #3585: 3585.patch
File 3585.patch, 2.2 KB (added by , 15 years ago) |
---|
-
core/htmlparser/fragment.js
75 75 pendingName = pendingElement.name, 76 76 pendingDtd = CKEDITOR.dtd[ pendingName ], 77 77 currentDtd = currentNode.name && CKEDITOR.dtd[ currentNode.name ]; 78 79 if ( ( !currentDtd || currentDtd[ pendingName ] ) && ( !newTagName || !pendingDtd || pendingDtd[ newTagName ] || !CKEDITOR.dtd[ newTagName ] ))78 // Check for any pending text nodes. 79 if ( !pendingName ) 80 80 { 81 // Remove the pending first. 82 pendingInline.splice( i, 1 ); 83 i--; 84 if ( fixForBody && !currentNode.type ) 85 this.onTagOpen( 'p', {} ); 86 currentNode.add( pendingElement ); 87 } 88 else if ( ( !currentDtd || currentDtd[ pendingName ] ) && ( !newTagName || !pendingDtd || pendingDtd[ newTagName ] || !CKEDITOR.dtd[ newTagName ] ) ) 89 { 81 90 // Get a clone for the pending element. 82 91 pendingElement = pendingElement.clone(); 83 92 … … 196 205 } 197 206 } 198 207 199 checkPending (tagName );208 checkPending.call( this, tagName ); 200 209 201 210 element.parent = currentNode; 202 211 element.returnPoint = returnPoint; … … 210 219 211 220 parser.onTagClose = function( tagName ) 212 221 { 222 // Check for the last pending text node, rtrim the node value. 223 var lastPending = pendingInline[ pendingInline.length -1 ]; 224 if ( lastPending && !lastPending.name ) 225 { 226 var lastTextNode = pendingInline.pop(), 227 textValue = CKEDITOR.tools.rtrim( lastTextNode.value ); 228 if ( textValue.length ) 229 currentNode.add( new CKEDITOR.htmlParser.text( textValue ) ); 230 } 231 213 232 var index = 0, 214 233 pendingAdd = [], 215 234 candidate = currentNode; … … 281 300 return; 282 301 } 283 302 284 checkPending(); 303 checkPending.call( this ); 304 // We need remove the tail-spaces, so pending the text for checking later. 305 pendingInline.push( new CKEDITOR.htmlParser.text( text ) ); 285 306 286 if ( fixForBody && !currentNode.type )287 this.onTagOpen( 'p', {} );288 289 currentNode.add( new CKEDITOR.htmlParser.text( text ) );290 307 }; 291 308 292 309 parser.onCDATA = function( cdata )