Index: /CKEditor/trunk/_source/core/htmlparser/fragment.js
===================================================================
--- /CKEditor/trunk/_source/core/htmlparser/fragment.js	(revision 6645)
+++ /CKEditor/trunk/_source/core/htmlparser/fragment.js	(revision 6646)
@@ -185,5 +185,5 @@
 		}
 
-		parser.onTagOpen = function( tagName, attributes, selfClosing )
+		parser.onTagOpen = function( tagName, attributes, selfClosing, optionalClose )
 		{
 			var element = new CKEDITOR.htmlParser.element( tagName, attributes );
@@ -194,4 +194,6 @@
 				element.isEmpty = true;
 
+			element.isOptionalClose = optionalClose;
+
 			// This is a tag to be removed if empty, so do not add it immediately.
 			if ( CKEDITOR.dtd.$removeEmpty[ tagName ] )
@@ -225,6 +227,10 @@
 				if ( !element.isUnknown && !currentNode.isUnknown && !currentDtd[ tagName ] )
 				{
+					// Current node doesn't have a close tag, time for a close
+					// as this element isn't fit in. (#7497)
+					if ( currentNode.isOptionalClose )
+						parser.onTagClose( currentName );
 					// Fixing malformed nested lists by moving it into a previous list item. (#3828)
-					if ( tagName in listBlocks
+					else if ( tagName in listBlocks
 						&& currentName in listBlocks )
 					{
@@ -236,9 +242,10 @@
 							addElement( ( lastChild = new CKEDITOR.htmlParser.element( 'li' ) ), currentNode );
 
+						!element.returnPoint && ( element.returnPoint = currentNode );
 						currentNode = lastChild;
 					}
 					// Establish new list root for orphan list items.
 					else if ( tagName in CKEDITOR.dtd.$listItem && currentName != tagName )
-						parser.onTagOpen( tagName == 'li' ? 'ul' : 'dl', {} );
+						parser.onTagOpen( tagName == 'li' ? 'ul' : 'dl', {}, 0, 1 );
 					// We're inside a structural block like table and list, AND the incoming element
 					// is not of the same type (e.g. <td>td1<td>td2</td>), we simply add this new one before it,
@@ -370,5 +377,5 @@
 				 && CKEDITOR.tools.trim( text ) )
 			{
-				this.onTagOpen( fixForBody, {} );
+				this.onTagOpen( fixForBody, {}, 0, 1 );
 			}
 
