For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
+/**\r
+ * @class\r
+ */\r
CKEDITOR.dom.range = function( document )\r
{\r
this.startContainer = null;\r
this.collapsed = true;\r
},\r
\r
- // The selection may be lost when cloning (due to the splitText() call).\r
+ /**\r
+ * The content nodes of the range are cloned and added to a document fragment, which is returned.\r
+ * <strong> Note: </strong> Text selection may lost after invoking this method. (caused by text node splitting).\r
+ */\r
cloneContents : function()\r
{\r
var docFrag = new CKEDITOR.dom.documentFragment( this.document );\r
return docFrag;\r
},\r
\r
+ /**\r
+ * Deletes the content nodes of the range permanently from the DOM tree.\r
+ */\r
deleteContents : function()\r
{\r
if ( this.collapsed )\r
execContentsAction( this, 0 );\r
},\r
\r
+ /**\r
+ * The content nodes of the range are cloned and added to a document fragment,\r
+ * meanwhile they're removed permanently from the DOM tree.\r
+ */\r
extractContents : function()\r
{\r
var docFrag = new CKEDITOR.dom.documentFragment( this.document );\r
}\r
}\r
\r
- var walker = new CKEDITOR.dom.walker( walkerRange );\r
+ var walker = new CKEDITOR.dom.walker( walkerRange ),\r
+ isBookmark = CKEDITOR.dom.walker.bookmark();\r
\r
walker.evaluator = function( node )\r
{\r
var currentElement;\r
walker.guard = function( node, movingOut )\r
{\r
+ if ( isBookmark( node ) )\r
+ return true;\r
+\r
// Stop when we're shrink in element mode while encountering a text node.\r
if ( mode == CKEDITOR.SHRINK_ELEMENT && node.type == CKEDITOR.NODE_TEXT )\r
return false;\r
// Fixing invalid range start inside dtd empty elements.\r
if( startNode.type == CKEDITOR.NODE_ELEMENT\r
&& CKEDITOR.dtd.$empty[ startNode.getName() ] )\r
- startNode = startNode.getParent(), startOffset = startNode.getIndex();\r
+ startOffset = startNode.getIndex(), startNode = startNode.getParent();\r
\r
this.startContainer = startNode;\r
this.startOffset = startOffset;\r
// Fixing invalid range end inside dtd empty elements.\r
if( endNode.type == CKEDITOR.NODE_ELEMENT\r
&& CKEDITOR.dtd.$empty[ endNode.getName() ] )\r
- endNode = endNode.getParent(), endOffset = endNode.getIndex() + 1;\r
+ endOffset = endNode.getIndex() + 1, endNode = endNode.getParent();\r
\r
this.endContainer = endNode;\r
this.endOffset = endOffset;\r
CKEDITOR.ENLARGE_BLOCK_CONTENTS = 2;\r
CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS = 3;\r
\r
-/**\r
- * Check boundary types.\r
- * @see CKEDITOR.dom.range.prototype.checkBoundaryOfElement\r
- */\r
+// Check boundary types.\r
+// @see CKEDITOR.dom.range.prototype.checkBoundaryOfElement\r
CKEDITOR.START = 1;\r
CKEDITOR.END = 2;\r
CKEDITOR.STARTEND = 3;\r
\r
-/**\r
- * Shrink range types.\r
- * @see CKEDITOR.dom.range.prototype.shrink\r
- */\r
+// Shrink range types.\r
+// @see CKEDITOR.dom.range.prototype.shrink\r
CKEDITOR.SHRINK_ELEMENT = 1;\r
CKEDITOR.SHRINK_TEXT = 2;\r