Ticket #7494: 7494_3.patch
File 7494_3.patch, 3.1 KB (added by , 14 years ago) |
---|
-
_source/core/htmlparser/element.js
50 50 isEmpty = !!dtd.$empty[ name ]; 51 51 52 52 this.isEmpty = isEmpty; 53 // Indicate there's no explicit close tag on this element. 54 this.isOptionalClose = false; 55 // Indicate there's no explicit close tag on this element. 56 this.isOptionalClose = false; 53 57 this.isUnknown = !dtd[ name ]; 54 58 55 59 /** @private */ -
_source/core/htmlparser/fragment.js
184 184 currentNode = moveCurrent ? target : savedCurrent; 185 185 } 186 186 187 parser.onTagOpen = function( tagName, attributes, selfClosing )187 parser.onTagOpen = function( tagName, attributes, selfClosing, optionalClose ) 188 188 { 189 189 var element = new CKEDITOR.htmlParser.element( tagName, attributes ); 190 190 … … 193 193 if ( element.isUnknown && selfClosing ) 194 194 element.isEmpty = true; 195 195 196 element.isOptionalClose = optionalClose; 197 196 198 // This is a tag to be removed if empty, so do not add it immediately. 197 199 if ( CKEDITOR.dtd.$removeEmpty[ tagName ] ) 198 200 { … … 224 226 // If the element cannot be child of the current element. 225 227 if ( !element.isUnknown && !currentNode.isUnknown && !currentDtd[ tagName ] ) 226 228 { 229 // Current node doesn't have a close tag, time for a close 230 // as this element isn't fit in. (#7497) 231 if ( currentNode.isOptionalClose ) 232 parser.onTagClose( currentName ); 227 233 // Fixing malformed nested lists by moving it into a previous list item. (#3828) 228 if ( tagName in listBlocks234 else if ( tagName in listBlocks 229 235 && currentName in listBlocks ) 230 236 { 231 237 var children = currentNode.children, … … 235 241 if ( !( lastChild && lastChild.name == 'li' ) ) 236 242 addElement( ( lastChild = new CKEDITOR.htmlParser.element( 'li' ) ), currentNode ); 237 243 244 !element.returnPoint && ( element.returnPoint = currentNode ); 238 245 currentNode = lastChild; 239 246 } 240 247 // Establish new list root for orphan list items. 241 248 else if ( tagName in CKEDITOR.dtd.$listItem && currentName != tagName ) 242 parser.onTagOpen( tagName == 'li' ? 'ul' : 'dl', {} );249 parser.onTagOpen( tagName == 'li' ? 'ul' : 'dl', {}, 0, 1 ); 243 250 // We're inside a structural block like table and list, AND the incoming element 244 251 // is not of the same type (e.g. <td>td1<td>td2</td>), we simply add this new one before it, 245 252 // and most importantly, return back to here once this element is added, … … 369 376 && ( !currentNode.type || currentNode.name == 'body' ) 370 377 && CKEDITOR.tools.trim( text ) ) 371 378 { 372 this.onTagOpen( fixForBody, {} );379 this.onTagOpen( fixForBody, {}, 0, 1 ); 373 380 } 374 381 375 382 // Shrinking consequential spaces into one single for all elements