Index: /FCKeditor/trunk/_whatsnew.html
===================================================================
--- /FCKeditor/trunk/_whatsnew.html	(revision 1387)
+++ /FCKeditor/trunk/_whatsnew.html	(revision 1388)
@@ -56,4 +56,6 @@
 			are now being properly shown in Firefox Mac when placing FCKeditor inside a hidden
 			div.</li>
+		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/503">#503</a>] Orphaned
+			&lt;li&gt; elements now get properly enclosed in a &lt;ul&gt; on output.</li>
 	</ul>
 	<p>
Index: /FCKeditor/trunk/editor/_source/internals/fck.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fck.js	(revision 1387)
+++ /FCKeditor/trunk/editor/_source/internals/fck.js	(revision 1388)
@@ -177,5 +177,7 @@
 				// Element Node.
 				case 1 :
-					if ( !FCKListsLib.BlockElements[ oNode.nodeName.toLowerCase() ] && 
+					var nodeName = oNode.nodeName.toLowerCase() ;
+					if ( !FCKListsLib.BlockElements[ nodeName ] && 
+							nodeName != 'li' &&
 							!oNode.getAttribute('_fckfakelement') &&
 							oNode.getAttribute('_moz_dirty') == null )
@@ -1160,2 +1162,3 @@
 
 
+
Index: /FCKeditor/trunk/editor/_source/internals/fckxhtml.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckxhtml.js	(revision 1387)
+++ /FCKeditor/trunk/editor/_source/internals/fckxhtml.js	(revision 1388)
@@ -404,4 +404,33 @@
 	},
 
+	// Fix orphaned <li> nodes (Bug #503).
+	li : function( node, htmlNode, targetNode )
+	{
+		// If the XML parent node is already a <ul> or <ol>, then add the <li> as usual.
+		if ( targetNode.nodeName.IEquals( ['ul', 'ol'] ) )
+			return FCKXHtml._AppendChildNodes( node, htmlNode, true ) ;
+
+		var newTarget = FCKXHtml.XML.createElement( 'ul' ) ;
+
+		// Reset the _fckxhtmljob so the HTML node is processed again.
+		htmlNode._fckxhtmljob = null ; 
+
+		// Loop through all sibling LIs, adding them to the <ul>.
+		do
+		{
+			FCKXHtml._AppendNode( newTarget, htmlNode ) ;
+			
+			// Look for the next element following this <li>.
+			do
+			{
+				htmlNode = FCKDomTools.GetNextSibling( htmlNode ) ;
+			}
+			while ( htmlNode && htmlNode.nodeType == 3 && htmlNode.nodeValue.Trim().length == 0 )
+		}
+		while ( htmlNode && htmlNode.nodeName.toLowerCase() == 'li' )
+
+		return newTarget ;
+	},
+
 	// Fix nested <ul> and <ol>.
 	ol : function( node, htmlNode, targetNode )
