Index: _whatsnew.html
===================================================================
--- _whatsnew.html	(revision 1383)
+++ _whatsnew.html	(working copy)
@@ -47,11 +47,12 @@
 			several "strict warning" messages in Firefox when running FCKeditor.</li>
 		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1522">#1522</a>] The ENTER
 			key will now work properly in IE with the cursor at the start of a formatted block.</li>
-		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1503">#1503</a>] It's possible
-			to define in the Styles that a Style (with an empty class) must be shown selected
-			only when no class is present in the current element, and selecting that item will 
-			clear the current class (it does apply to any attribute, not only classes).</li>
-
+		<li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1503">#1503</a>] It's
+			possible to define in the Styles that a Style (with an empty class) must be shown
+			selected only when no class is present in the current element, and selecting that
+			item will clear the current class (it does apply to any attribute, not only classes).</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>
 		<a href="_whatsnew_history.html">See previous versions history</a>
Index: editor/_source/internals/fck.js
===================================================================
--- editor/_source/internals/fck.js	(revision 1383)
+++ editor/_source/internals/fck.js	(working copy)
@@ -176,7 +176,9 @@
 			{
 				// 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 )
 						bMoveNode = true ;
Index: editor/_source/internals/fckxhtml.js
===================================================================
--- editor/_source/internals/fckxhtml.js	(revision 1383)
+++ editor/_source/internals/fckxhtml.js	(working copy)
@@ -403,6 +403,35 @@
 		return node ;
 	},
 
+	// 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 )
 	{
