Ticket #4886: 4886_3.patch
File 4886_3.patch, 2.3 KB (added by , 13 years ago) |
---|
-
_source/core/htmlparser/fragment.js
64 64 html = [], 65 65 fragment = new CKEDITOR.htmlParser.fragment(), 66 66 pendingInline = [], 67 pendingBRs = [], 67 68 currentNode = fragment, 68 69 // Indicate we're inside a <pre> element, spaces should be touched differently. 69 70 inPre = false, … … 71 72 72 73 function checkPending( newTagName ) 73 74 { 75 var pendingBRsSent; 76 74 77 if ( pendingInline.length > 0 ) 75 78 { 76 79 for ( var i = 0 ; i < pendingInline.length ; i++ ) … … 82 85 83 86 if ( ( !currentDtd || currentDtd[ pendingName ] ) && ( !newTagName || !pendingDtd || pendingDtd[ newTagName ] || !CKEDITOR.dtd[ newTagName ] ) ) 84 87 { 88 if ( !pendingBRsSent ) 89 { 90 sendPendingBRs(); 91 pendingBRsSent = 1; 92 } 93 85 94 // Get a clone for the pending element. 86 95 pendingElement = pendingElement.clone(); 87 96 … … 99 108 } 100 109 } 101 110 111 function sendPendingBRs() 112 { 113 while ( pendingBRs.length ) 114 currentNode.add( pendingBRs.shift() ); 115 } 116 102 117 function addElement( element, target, enforceCurrent ) 103 118 { 104 119 target = target || currentNode || fragment; … … 181 196 return; 182 197 } 183 198 199 if ( tagName == 'br' ) 200 { 201 pendingBRs.push( element ); 202 return; 203 } 204 184 205 var currentName = currentNode.name; 185 206 186 207 var currentDtd = currentName … … 308 329 309 330 currentNode = candidate; 310 331 311 if ( currentNode.name == 'pre' )332 if ( currentNode.name == 'pre' ) 312 333 inPre = false; 313 334 335 if ( candidate._.isBlockLike ) 336 sendPendingBRs(); 337 314 338 addElement( candidate, candidate.parent ); 315 339 316 340 // The parent should start receiving new nodes now, except if … … 321 345 pendingInline = pendingInline.concat( newPendingInline ); 322 346 } 323 347 324 if ( tagName == 'body' )348 if ( tagName == 'body' ) 325 349 fixForBody = false; 326 350 }; 327 351 … … 336 360 return; 337 361 } 338 362 363 sendPendingBRs(); 339 364 checkPending(); 340 365 341 366 if ( fixForBody … … 366 391 // Parse it. 367 392 parser.parse( fragmentHtml ); 368 393 394 sendPendingBRs(); 395 369 396 // Close all pending nodes. 370 397 while ( currentNode.type ) 371 398 {