\r
currentNode = levelStartNode.getNext();\r
\r
- while( currentNode )\r
+ while ( currentNode )\r
{\r
// Stop processing when the current node matches a node in the\r
// endParents tree or if it is the endNode.\r
{\r
currentNode = levelStartNode.getPrevious();\r
\r
- while( currentNode )\r
+ while ( currentNode )\r
{\r
// Stop processing when the current node matches a node in the\r
// startParents tree or if it is the startNode.\r
}\r
\r
// Cleanup any marked node.\r
- if( removeStartNode )\r
+ if ( removeStartNode )\r
startNode.remove();\r
\r
- if( removeEndNode && endNode.$.parentNode )\r
+ if ( removeEndNode && endNode.$.parentNode )\r
endNode.remove();\r
};\r
\r
if ( CKEDITOR.tools.trim( node.getText() ).length )\r
return false;\r
}\r
- else if( node.type == CKEDITOR.NODE_ELEMENT )\r
+ else if ( node.type == CKEDITOR.NODE_ELEMENT )\r
{\r
// If there are non-empty inline elements (e.g. <img />), then we're not\r
// at the start.\r
\r
startOffset = startContainer.getIndex() + 1;\r
startContainer = startContainer.getParent();\r
- // Check if it is necessary to update the end boundary.\r
- if ( !collapsed && this.startContainer.equals( this.endContainer ) )\r
+\r
+ // Check all necessity of updating the end boundary.\r
+ if ( this.startContainer.equals( this.endContainer ) )\r
this.setEnd( nextText, this.endOffset - this.startOffset );\r
+ else if ( startContainer.equals( this.endContainer ) )\r
+ this.endOffset += 1;\r
}\r
\r
this.setStart( startContainer, startOffset );\r
\r
if ( collapsed )\r
+ {\r
this.collapse( true );\r
+ return;\r
+ }\r
}\r
\r
var endContainer = this.endContainer;\r