Ticket #6751: 6751.patch
File 6751.patch, 2.8 KB (added by , 13 years ago) |
---|
-
_source/core/htmlparser/element.js
127 127 { 128 128 var writer = new CKEDITOR.htmlParser.basicWriter(); 129 129 CKEDITOR.htmlParser.fragment.prototype.writeChildrenHtml.call( element, writer, filter ); 130 element.children = new CKEDITOR.htmlParser.fragment.fromHtml( writer.getHtml() ).children;130 element.children = new CKEDITOR.htmlParser.fragment.fromHtml( writer.getHtml(), 0, element.clone() ).children; 131 131 isChildrenFiltered = 1; 132 132 } 133 133 }; -
_source/core/htmlparser/fragment.js
52 52 * Creates a {@link CKEDITOR.htmlParser.fragment} from an HTML string. 53 53 * @param {String} fragmentHtml The HTML to be parsed, filling the fragment. 54 54 * @param {Number} [fixForBody=false] Wrap body with specified element if needed. 55 * @param {CKEDITOR.htmlParser.element} contextNode Parse the html as the content of this element. 55 56 * @returns CKEDITOR.htmlParser.fragment The fragment created. 56 57 * @example 57 58 * var fragment = CKEDITOR.htmlParser.fragment.fromHtml( '<b>Sample</b> Text' ); 58 59 * alert( fragment.children[0].name ); "b" 59 60 * alert( fragment.children[1].value ); " Text" 60 61 */ 61 CKEDITOR.htmlParser.fragment.fromHtml = function( fragmentHtml, fixForBody )62 CKEDITOR.htmlParser.fragment.fromHtml = function( fragmentHtml, fixForBody, contextNode ) 62 63 { 63 64 var parser = new CKEDITOR.htmlParser(), 64 html = [], 65 fragment = new CKEDITOR.htmlParser.fragment(), 65 fragment = contextNode || new CKEDITOR.htmlParser.fragment(), 66 66 pendingInline = [], 67 67 pendingBRs = [], 68 68 currentNode = fragment, … … 308 308 newPendingInline = [], 309 309 candidate = currentNode; 310 310 311 while ( candidate .type&& candidate.name != tagName )311 while ( candidate != fragment && candidate.name != tagName ) 312 312 { 313 313 // If this is an inline element, add it to the pending list, if we're 314 314 // really closing one of the parents element later, they will continue … … 324 324 candidate = candidate.parent; 325 325 } 326 326 327 if ( candidate .type)327 if ( candidate != fragment ) 328 328 { 329 329 // Add all elements that have been found in the above loop. 330 330 for ( i = 0 ; i < pendingAdd.length ; i++ ) … … 403 403 sendPendingBRs( !CKEDITOR.env.ie && 1 ); 404 404 405 405 // Close all pending nodes. 406 while ( currentNode .type)406 while ( currentNode != fragment ) 407 407 { 408 408 var parent = currentNode.parent, 409 409 node = currentNode;