Ticket #7894: 7894_2.patch
File 7894_2.patch, 1.6 KB (added by , 13 years ago) |
---|
-
_source/core/htmlparser/fragment.js
49 49 // Dtd of the fragment element, basically it accept anything except for intermediate structure, e.g. orphan <li>. 50 50 var rootDtd = CKEDITOR.tools.extend( {}, { html: 1 }, CKEDITOR.dtd.html, CKEDITOR.dtd.body, CKEDITOR.dtd.head, { style:1,script:1 } ); 51 51 52 function isRemoveEmpty( node ) 53 { 54 // Empty link is to be removed when empty but not anchor. (#7894) 55 return node.name == 'a' && node.attributes.href 56 || CKEDITOR.dtd.$removeEmpty[ node.name ]; 57 } 58 52 59 /** 53 60 * Creates a {@link CKEDITOR.htmlParser.fragment} from an HTML string. 54 61 * @param {String} fragmentHtml The HTML to be parsed, filling the fragment. … … 104 111 pendingInline.splice( i, 1 ); 105 112 i--; 106 113 } 107 } 108 } 109 } 114 else 115 { 116 // Some element of the same type cannot be nested, flat them, 117 // e.g. <a href="#">foo<a href="#">bar</a></a>. (#7894) 118 if ( pendingName == currentNode.name ) 119 addElement( currentNode, currentNode.parent, 1 ), i--; 120 } 121 } 122 } 123 } 110 124 111 125 function sendPendingBRs() 112 126 { … … 200 214 element.isOptionalClose = tagName in optionalCloseTags || optionalClose; 201 215 202 216 // This is a tag to be removed if empty, so do not add it immediately. 203 if ( CKEDITOR.dtd.$removeEmpty[ tagName ])217 if ( isRemoveEmpty( element ) ) 204 218 { 205 219 pendingInline.push( element ); 206 220 return;