Index: /CKEditor/trunk/_source/plugins/list/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/list/plugin.js	(revision 3312)
+++ /CKEditor/trunk/_source/plugins/list/plugin.js	(revision 3313)
@@ -125,6 +125,8 @@
 						currentListItem.appendBogus();
 					}
-
-					if ( currentListItem.getName() == paragraphName && currentListItem.$.firstChild )
+					
+					if ( currentListItem.type == CKEDITOR.NODE_ELEMENT && 
+							currentListItem.getName() == paragraphName &&
+							currentListItem.$.firstChild )
 					{
 						currentListItem.trim();
Index: /CKEditor/trunk/_source/tests/plugins/list/list.html
===================================================================
--- /CKEditor/trunk/_source/tests/plugins/list/list.html	(revision 3313)
+++ /CKEditor/trunk/_source/tests/plugins/list/list.html	(revision 3313)
@@ -0,0 +1,284 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<title>Plugin: toolbar</title>
+	<link rel="stylesheet" type="text/css" href="../../test.css" />
+	<script type="text/javascript" src="../../../../ckeditor_source.js"></script>
+	<script type="text/javascript" src="../../test.js"></script>
+	<script type="text/javascript">
+	//<![CDATA[
+/**
+ * Load the editor and wait for fully interactable.
+ * @param {Object} elementId
+ * @parma {Object} mode
+ * @param {Object} config
+ * @param {Object} callback Continuation with {@param editor}.
+ * @param {Object} context
+ */
+function prepareEditor( elementId, mode, config, callback, context )
+{
+	CKEDITOR.on( 'instanceReady',
+		function( evt )
+		{
+			var isMe = mode == CKEDITOR.ELEMENT_MODE_REPLACE ? 
+				evt.editor.name == elementId
+				: evt.editor.element.$ == 
+					document.getElementById( elementId );
+			if ( isMe )
+			{
+				callback.call( context, evt.editor );
+			}
+		}, this );
+
+	mode = mode || CKEDITOR.ELEMENT_MODE_REPLACE;
+	switch( mode )
+	{
+		case CKEDITOR.ELEMENT_MODE_REPLACE :
+			CKEDITOR.replace( elementId, config );
+			break;
+		case CKEDITOR.ELEMENT_MODE_APPENDTO :
+			CKEDITOR.appendTo( elementId, config );
+			break;
+	}
+}
+
+/**
+ * IE always returning CRLF for line-feed, so remove it when retrieving
+ * pre-formated text from text area.
+ */
+function getTextAreaValue( id )
+{
+	return CKEDITOR.document.getById( id ).getValue().replace( /\r/gi, '' );
+}
+
+CKEDITOR.test.addTestCase( ( function()
+	{
+		
+		// Local references.
+		var assert = CKEDITOR.test.assert, 
+			doc = CKEDITOR.document,
+			action = YAHOO.util.UserAction,
+			selector = YAHOO.util.Selector;
+
+		/**
+		 * Set the range with the start/end position specified by the locator, which in form of bookmark2.
+		 * @param {Object} range
+		 * @param {Array} startPosition range start path including offset
+		 * @param {Array|Boolean} endPositoin range end path including offset or is collapsed 
+		 */
+		function setRange( range, startPosition, endPositoin )
+		{
+			var bm = {
+				end : null, 
+				start : null, 
+				is2: true, 
+				startOffset : 0, 
+				endoffset : 0
+			};
+			bm.start = startPosition.slice( 0, startPosition.length - 1 );
+			bm.startOffset = startPosition[ startPosition.length -1];
+			if( endPositoin === true )
+			{
+				bm.end = bm.start.slice();
+				bm.endOffset = bm.startOffset;
+			}
+			else
+			{
+				bm.end = endPositoin.slice( 0, endPositoin.length - 1 );
+				bm.endOffset = endPositoin[ endPositoin.length -1 ];
+			}
+			range.moveToBookmark( bm );
+		}
+
+		return	{
+			
+			/**
+			 *  Test remove numbered list with 'enterMode = BR'. 
+			 */
+			test_ticket_3151 : function()
+			{
+				prepareEditor( 'test_ticket_3151_editor', null, 
+					{ enterMode : CKEDITOR.ENTER_BR }, 
+					function( editor )
+					{
+						this.resume( function()
+						{
+							editor.focus();
+							
+							// Force result data unformatted.
+							editor.dataProcessor.writer._.rules = {};
+							
+							var doc = editor.document, 
+								range = new CKEDITOR.dom.range( doc );
+							
+							setRange( range, [ 1, 0, 0, 0, 0 ], true );
+							var sel = editor.getSelection();
+							sel.selectRanges( [ range ] );
+							
+							// Waiting for 'comand state' effected.
+							this.wait( function(){
+								// Remove list.
+								editor.execCommand( 'numberedlist' );
+								assert.areSame( getTextAreaValue( 'test_ticket_3151_resultContent' ), 
+									editor.getData(), 
+									'Remove list result not correct.' );
+							}, 1000);
+							
+						} );
+					}, this );
+					this.wait();	
+			},
+
+			name :document.title
+		};
+	} )() );
+	//]]>
+	</script>
+</head>
+<body>
+<textarea id="test_ticket_3151_editor"><ol><li>text</li></ol></textarea>
+<textarea id="test_ticket_3151_resultContent">text</textarea>
+</body>
+</html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<title>Plugin: toolbar</title>
+	<link rel="stylesheet" type="text/css" href="../../test.css" />
+	<script type="text/javascript" src="../../../../ckeditor_source.js"></script>
+	<script type="text/javascript" src="../../test.js"></script>
+	<script type="text/javascript">
+	//<![CDATA[
+/**
+ * Load the editor and wait for fully interactable.
+ * @param {Object} elementId
+ * @parma {Object} mode
+ * @param {Object} config
+ * @param {Object} callback Continuation with {@param editor}.
+ * @param {Object} context
+ */
+function prepareEditor( elementId, mode, config, callback, context )
+{
+	CKEDITOR.on( 'instanceReady',
+		function( evt )
+		{
+			var isMe = mode == CKEDITOR.ELEMENT_MODE_REPLACE ? 
+				evt.editor.name == elementId
+				: evt.editor.element.$ == 
+					document.getElementById( elementId );
+			if ( isMe )
+			{
+				callback.call( context, evt.editor );
+			}
+		}, this );
+
+	mode = mode || CKEDITOR.ELEMENT_MODE_REPLACE;
+	switch( mode )
+	{
+		case CKEDITOR.ELEMENT_MODE_REPLACE :
+			CKEDITOR.replace( elementId, config );
+			break;
+		case CKEDITOR.ELEMENT_MODE_APPENDTO :
+			CKEDITOR.appendTo( elementId, config );
+			break;
+	}
+}
+
+/**
+ * IE always returning CRLF for line-feed, so remove it when retrieving
+ * pre-formated text from text area.
+ */
+function getTextAreaValue( id )
+{
+	return CKEDITOR.document.getById( id ).getValue().replace( /\r/gi, '' );
+}
+
+CKEDITOR.test.addTestCase( ( function()
+	{
+		
+		// Local references.
+		var assert = CKEDITOR.test.assert, 
+			doc = CKEDITOR.document,
+			action = YAHOO.util.UserAction,
+			selector = YAHOO.util.Selector;
+
+		/**
+		 * Set the range with the start/end position specified by the locator, which in form of bookmark2.
+		 * @param {Object} range
+		 * @param {Array} startPosition range start path including offset
+		 * @param {Array|Boolean} endPositoin range end path including offset or is collapsed 
+		 */
+		function setRange( range, startPosition, endPositoin )
+		{
+			var bm = {
+				end : null, 
+				start : null, 
+				is2: true, 
+				startOffset : 0, 
+				endoffset : 0
+			};
+			bm.start = startPosition.slice( 0, startPosition.length - 1 );
+			bm.startOffset = startPosition[ startPosition.length -1];
+			if( endPositoin === true )
+			{
+				bm.end = bm.start.slice();
+				bm.endOffset = bm.startOffset;
+			}
+			else
+			{
+				bm.end = endPositoin.slice( 0, endPositoin.length - 1 );
+				bm.endOffset = endPositoin[ endPositoin.length -1 ];
+			}
+			range.moveToBookmark( bm );
+		}
+
+		return	{
+			
+			/**
+			 *  Test remove numbered list with 'enterMode = BR'. 
+			 */
+			test_ticket_3151 : function()
+			{
+				prepareEditor( 'test_ticket_3151_editor', null, 
+					{ enterMode : CKEDITOR.ENTER_BR }, 
+					function( editor )
+					{
+						this.resume( function()
+						{
+							editor.focus();
+							
+							// Force result data unformatted.
+							editor.dataProcessor.writer._.rules = {};
+							
+							var doc = editor.document, 
+								range = new CKEDITOR.dom.range( doc );
+							
+							setRange( range, [ 1, 0, 0, 0, 0 ], true );
+							var sel = editor.getSelection();
+							sel.selectRanges( [ range ] );
+							
+							// Waiting for 'comand state' effected.
+							this.wait( function(){
+								// Remove list.
+								editor.execCommand( 'numberedlist' );
+								assert.areSame( getTextAreaValue( 'test_ticket_3151_resultContent' ), 
+									editor.getData(), 
+									'Remove list result not correct.' );
+							}, 1000);
+							
+						} );
+					}, this );
+					this.wait();	
+			},
+
+			name :document.title
+		};
+	} )() );
+	//]]>
+	</script>
+</head>
+<body>
+<textarea id="test_ticket_3151_editor"><ol><li>text</li></ol></textarea>
+<textarea id="test_ticket_3151_resultContent">text</textarea>
+</body>
+</html>
