Index: _source/tests/core/dom/range.html =================================================================== --- _source/tests/core/dom/range.html (revision 3733) +++ _source/tests/core/dom/range.html Thu Jul 30 17:52:30 CST 2009 @@ -1059,6 +1059,20 @@ assert.isTrue( range.collapsed, 'range.collapsed' ); }, + /** + * Test enlarge list when there's no nodes between + * range start and the block boundary. + */ + test_enlarge_block6 : function() + { + var range = getRange( 'S11', null ); + range.enlarge( CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ); + + assert.areSame( document.getElementById( '_EnlargeP17' ), + range.startContainer.$, 'range.startContainer' ); + assert.areSame( 0, range.startOffset, 'range.startOffset' ); + }, + test_deleteContents_W3C_1 : function() { // W3C DOM Range Specs - Section 2.6 - Example 1 @@ -2384,6 +2398,7 @@
Test List
Item Enlarge
Test Block
Enlarge
Test Block Enlarge
Test trim
Index: _source/core/dom/range.js =================================================================== --- _source/core/dom/range.js (revision 4014) +++ _source/core/dom/range.js Thu Jul 30 17:46:50 CST 2009 @@ -129,7 +129,7 @@ // For Extract and Clone, we must clone this level. if ( clone && !levelStartNode.equals( startNode ) ) // action = 0 = Delete - levelClone = clone.append( levelStartNode.clone( false, action == 1 ) ); + levelClone = clone.append( levelStartNode.clone() ); currentNode = levelStartNode.getNext(); @@ -173,7 +173,7 @@ // For Extract and Clone, we must clone this level. if ( action > 0 && !levelStartNode.equals( endNode ) ) // action = 0 = Delete - levelClone = clone.append( levelStartNode.clone( false, action == 1 ) ); + levelClone = clone.append( levelStartNode.clone() ); // The processing of siblings may have already been done by the parent. if ( !startParents[ k ] || levelStartNode.$.parentNode != startParents[ k ].$.parentNode ) @@ -1174,19 +1174,18 @@ walker.guard = boundaryGuard; - if ( ( enlargeable = walker.lastBackward() ) ) - { - // It's the body which stop the enlaring if no block boundary found. + enlargeable = walker.lastBackward() + // It's the body which stop the enlarging if no block boundary found. - blockBoundary = blockBoundary || body; + blockBoundary = blockBoundary || body; - // Start the range at different position by comparing - // the document position of it with 'enlargeable' node. - this.setStartAt( - blockBoundary, + // Start the range at different position by comparing + // the document position of it with 'enlargeable' node. + this.setStartAt( + blockBoundary, - blockBoundary.contains( enlargeable ) ? + !blockBoundary.is( 'br' ) && + ( !enlargeable || blockBoundary.contains( enlargeable ) ) ? - CKEDITOR.POSITION_AFTER_START : - CKEDITOR.POSITION_AFTER_END ); + CKEDITOR.POSITION_AFTER_START : + CKEDITOR.POSITION_AFTER_END ); - } // Enlarging the end boundary. walkerRange = this.clone(); @@ -1200,19 +1199,18 @@ blockBoundary = null; // End the range right before the block boundary node. - if ( ( enlargeable = walker.lastForward() ) ) - { - // It's the body which stop the enlaring if no block boundary found. + enlargeable = walker.lastForward() + // It's the body which stop the enlarging if no block boundary found. - blockBoundary = blockBoundary || body; + blockBoundary = blockBoundary || body; - // Start the range at different position by comparing - // the document position of it with 'enlargeable' node. - this.setEndAt( - blockBoundary, + // Start the range at different position by comparing + // the document position of it with 'enlargeable' node. + this.setEndAt( + blockBoundary, - blockBoundary.contains( enlargeable ) ? + !blockBoundary.is( 'br' ) && + ( !enlargeable || blockBoundary.contains( enlargeable ) ) ? - CKEDITOR.POSITION_BEFORE_END : - CKEDITOR.POSITION_BEFORE_START ); + CKEDITOR.POSITION_BEFORE_END : + CKEDITOR.POSITION_BEFORE_START ); - } // We must include the