X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fcore%2Fdom%2Frange.js;h=8f10980e472a859f093ce39bc09249c49e4af736;hp=b43a82dbf08b520e0b23d271b2cab1dd355b0224;hb=614511639979907ceb0da3614122a4d8eb963ad4;hpb=039a051ccf3901311661022a30afd60fc38130c9 diff --git a/_source/core/dom/range.js b/_source/core/dom/range.js index b43a82d..8f10980 100644 --- a/_source/core/dom/range.js +++ b/_source/core/dom/range.js @@ -351,7 +351,10 @@ CKEDITOR.dom.range = function( document ) this.collapsed = true; }, - // The selection may be lost when cloning (due to the splitText() call). + /** + * The content nodes of the range are cloned and added to a document fragment, which is returned. + * Note: Text selection may lost after invoking this method. (caused by text node splitting). + */ cloneContents : function() { var docFrag = new CKEDITOR.dom.documentFragment( this.document ); @@ -362,6 +365,9 @@ CKEDITOR.dom.range = function( document ) return docFrag; }, + /** + * Deletes the content nodes of the range permanently from the DOM tree. + */ deleteContents : function() { if ( this.collapsed ) @@ -370,6 +376,10 @@ CKEDITOR.dom.range = function( document ) execContentsAction( this, 0 ); }, + /** + * The content nodes of the range are cloned and added to a document fragment, + * meanwhile they're removed permanently from the DOM tree. + */ extractContents : function() { var docFrag = new CKEDITOR.dom.documentFragment( this.document ); @@ -1405,7 +1415,7 @@ CKEDITOR.dom.range = function( document ) // Fixing invalid range start inside dtd empty elements. if( startNode.type == CKEDITOR.NODE_ELEMENT && CKEDITOR.dtd.$empty[ startNode.getName() ] ) - startNode = startNode.getParent(), startOffset = startNode.getIndex(); + startOffset = startNode.getIndex(), startNode = startNode.getParent(); this.startContainer = startNode; this.startOffset = startOffset;