Index: /FCKeditor/trunk/editor/_source/classes/fckw3crange.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckw3crange.js	(revision 94)
+++ /FCKeditor/trunk/editor/_source/classes/fckw3crange.js	(revision 95)
@@ -219,9 +219,9 @@
 			if ( endNode.childNodes.length > 0 )
 			{
-				// If the offset points after the last node, let's use
-				// the last one, but mark it for removal.
+				// If the offset points after the last node.
 				if ( endOffset > endNode.childNodes.length - 1 )
 				{
-					endNode = endNode.lastChild ;
+					// Let's create a temporary node and mark it for removal.
+					endNode = FCKDomTools.InsertAfterNode( endNode.lastChild, this._Document.createTextNode('') ) ;
 					removeEndNode = true ;
 				}
@@ -253,5 +253,6 @@
 				if ( startOffset == 0 )
 				{
-					startNode = startNode.firstChild ;
+					// Let's create a temporary node and mark it for removal.
+					startNode = startNode.insertBefore( this._Document.createTextNode(''), startNode.firstChild ) ;
 					removeStartNode = true ;
 				}
@@ -259,22 +260,4 @@
 					startNode = startNode.childNodes[ startOffset ].previousSibling ;
 			}
-		}
-
-		// There is a special case where a node contents with just one child is in the range:
-		// selectNodeContents( node ) -> node.childNodes.lenght == 1
-		if ( startNode == endNode && removeStartNode && removeEndNode )
-		{
-			if ( action == 2 )
-				docFrag.RootNode.appendChild( startNode.cloneNode( true ) ) ;
-			else
-			{
-				startNode.parentNode.removeChild( startNode ) ;
-				
-				if ( action == 1 )
-					docFrag.RootNode.appendChild( startNode ) ;
-				
-				this.collapse( true ) ;
-			}
-			return ;
 		}
 		
@@ -311,6 +294,6 @@
 			
 			// For Extract and Clone, we must clone this level.
-			if ( clone && ( removeStartNode || levelStartNode != startNode ) )		// action = 0 = Delete
-				levelClone = clone.appendChild( levelStartNode.cloneNode( removeStartNode && levelStartNode == startNode ) ) ;
+			if ( clone && levelStartNode != startNode )		// action = 0 = Delete
+				levelClone = clone.appendChild( levelStartNode.cloneNode( levelStartNode == startNode ) ) ;
 			
 			currentNode = levelStartNode.nextSibling ;
@@ -356,6 +339,6 @@
 			
 			// For Extract and Clone, we must clone this level.
-			if ( action > 0 && ( removeEndNode || levelStartNode != endNode ) )		// action = 0 = Delete
-				levelClone = clone.appendChild( levelStartNode.cloneNode( removeEndNode && levelStartNode == endNode ) ) ;
+			if ( action > 0 && levelStartNode != endNode )		// action = 0 = Delete
+				levelClone = clone.appendChild( levelStartNode.cloneNode( levelStartNode == endNode ) ) ;
 
 			// The processing of siblings may have already been done by the parent.
@@ -399,16 +382,16 @@
 			// No changes in the DOM should be done, so fix the split text (if any).
 
-			startNode = this.startContainer ;
-			if ( startNode.nodeType == 3 )
-			{
-				startNode.data += startNode.nextSibling.data ;
-				startNode.parentNode.removeChild( startNode.nextSibling ) ;
-			}
-
-			endNode = this.endContainer ;
-			if ( endNode.nodeType == 3 && endNode.nextSibling )
-			{
-				endNode.data += endNode.nextSibling.data ;
-				endNode.parentNode.removeChild( endNode.nextSibling ) ;
+			var startTextNode = this.startContainer ;
+			if ( startTextNode.nodeType == 3 )
+			{
+				startTextNode.data += startTextNode.nextSibling.data ;
+				startTextNode.parentNode.removeChild( startTextNode.nextSibling ) ;
+			}
+
+			var endTextNode = this.endContainer ;
+			if ( endTextNode.nodeType == 3 && endTextNode.nextSibling )
+			{
+				endTextNode.data += endTextNode.nextSibling.data ;
+				endTextNode.parentNode.removeChild( endTextNode.nextSibling ) ;
 			}
 		}
@@ -424,12 +407,12 @@
 			// Collapse it to the start.
 			this.collapse( true ) ;
-
-			// Cleanup any marked node.
-			if( removeStartNode )
-				startNode.parentNode.removeChild( startNode ) ;
-
-			if( removeEndNode && endNode.parentNode )
-				endNode.parentNode.removeChild( endNode ) ;
-		}
+		}
+
+		// Cleanup any marked node.
+		if( removeStartNode )
+			startNode.parentNode.removeChild( startNode ) ;
+
+		if( removeEndNode && endNode.parentNode )
+			endNode.parentNode.removeChild( endNode ) ;
 	},
 
Index: /FCKeditor/trunk/editor/_source/internals/fckdomtools.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckdomtools.js	(revision 94)
+++ /FCKeditor/trunk/editor/_source/internals/fckdomtools.js	(revision 95)
@@ -207,5 +207,5 @@
 	InsertAfterNode : function( existingNode, newNode )
 	{
-		existingNode.parentNode.insertBefore( newNode, existingNode.nextSibling ) ;
+		return existingNode.parentNode.insertBefore( newNode, existingNode.nextSibling ) ;
 	},
 	
