Index: /CKEditor/trunk/_source/plugins/htmldataprocessor/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/htmldataprocessor/plugin.js	(revision 4316)
+++ /CKEditor/trunk/_source/plugins/htmldataprocessor/plugin.js	(revision 4317)
@@ -12,4 +12,15 @@
 	var protectedSourceMarker = '{cke_protected}';
 
+
+	// Return the last non-space child node of the block (#4344).
+	function lastNoneSpaceChild( block )
+	{
+		var lastIndex = block.children.length,
+			last = block.children[ lastIndex - 1 ];
+		while(  last && last.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.trim( last.value ) )
+			last = block.children[ --lastIndex ];
+		return last;
+	}
+	
 	function trimFillers( block, fromSource )
 	{
@@ -19,6 +30,5 @@
 		// Also, any &nbsp; at the end of blocks are fillers, remove them as well.
 		// (#2886)
-		var children = block.children;
-		var lastChild = children[ children.length - 1 ];
+		var children = block.children, lastChild = lastNoneSpaceChild( block );
 		if ( lastChild )
 		{
@@ -32,9 +42,6 @@
 	function blockNeedsExtension( block )
 	{
-		if ( block.children.length < 1 )
-			return true;
-
-		var lastChild = block.children[ block.children.length - 1 ];
-		return lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br';
+		var lastChild = lastNoneSpaceChild( block );
+		return !lastChild || lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br';
 	}
 
