Ticket #8344: 8344.patch
File 8344.patch, 2.8 KB (added by , 13 years ago) |
---|
-
_source/core/htmlparser/element.js
157 157 }, 158 158 159 159 /** 160 * Whether the provided element is identical this one. An identical element 161 * has the same name and attributes. 162 * @param {CKEDITOR.htmlParser.element} otherElement The element to be compared. 163 * @returns {Boolean} 'true' if the elements are identical. 164 */ 165 isIdentical : function( otherElement ) 166 { 167 if ( !otherElement.name || otherElement.name != this.name ) 168 return false; 169 170 var attribsA = this.attributes, 171 attribsB = otherElement.attributes, 172 lenA = 0, 173 lenB = 0; 174 175 // Check if all attributes available on A are defined on B. 176 for ( var att in attribsA ) 177 { 178 if ( attribsA[ att ] !== attribsB[ att ] ) 179 return false; 180 181 // Count the number of attribs on A. 182 lenA++; 183 } 184 185 // Count the number of attribs on B. 186 for ( att in attribsB ) 187 lenB++; 188 189 return lenA == lenB; 190 }, 191 192 /** 160 193 * Writes the element HTML to a CKEDITOR.htmlWriter. 161 194 * @param {CKEDITOR.htmlWriter} writer The writer to which write the HTML. 162 195 * @example -
_source/core/htmlparser/fragment.js
92 92 pendingDtd = CKEDITOR.dtd[ pendingName ], 93 93 currentDtd = currentNode.name && CKEDITOR.dtd[ currentNode.name ]; 94 94 95 if ( pendingElement.ignore ) 96 continue; 97 95 98 if ( ( !currentDtd || currentDtd[ pendingName ] ) && ( !newTagName || !pendingDtd || pendingDtd[ newTagName ] || !CKEDITOR.dtd[ newTagName ] ) ) 96 99 { 97 100 if ( !pendingBRsSent ) … … 218 221 // This is a tag to be removed if empty, so do not add it immediately. 219 222 if ( isRemoveEmpty( element ) ) 220 223 { 224 // The element must be marked to be ignored if there is already another 225 // identical element to be used. (#8322) 226 for ( var i = 0 ; i < pendingInline.length ; i++ ) 227 { 228 if ( element.isIdentical( pendingInline[i] ) ) 229 { 230 element.ignore = 1; 231 break; 232 } 233 } 234 235 if ( !element.ignore ) 236 { 237 // The element must be marked to be ignored if there is already an 238 // identical element on the parents tree. (#8322) 239 var parent = currentNode; 240 while ( parent ) 241 { 242 if ( element.isIdentical( parent ) ) 243 element.ignore = 1; 244 parent = parent.parent; 245 } 246 } 247 221 248 pendingInline.push( element ); 222 249 return; 223 250 }