Ticket #4150: 4150.patch
File 4150.patch, 6.2 KB (added by , 14 years ago) |
---|
-
_source/tests/core/dom/range.html
1059 1059 assert.isTrue( range.collapsed, 'range.collapsed' ); 1060 1060 }, 1061 1061 1062 /** 1063 * Test enlarge list when there's no nodes between 1064 * range start and the block boundary. 1065 */ 1066 test_enlarge_block6 : function() 1067 { 1068 var range = getRange( 'S11', null ); 1069 range.enlarge( CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ); 1070 1071 assert.areSame( document.getElementById( '_EnlargeP17' ), 1072 range.startContainer.$, 'range.startContainer' ); 1073 assert.areSame( 0, range.startOffset, 'range.startOffset' ); 1074 }, 1075 1062 1076 test_deleteContents_W3C_1 : function() 1063 1077 { 1064 1078 // W3C DOM Range Specs - Section 2.6 - Example 1 … … 2384 2398 <p id="_EnlargeP14"><span id="S8"></span></p> 2385 2399 <p id="_EnlargeP15">Test <span id="S9"></span>List<br/ >Item Enlarge</p> 2386 2400 <p id="_EnlargeP16">Test <strong>Block<span id="S10"></span></strong><br /><br />Enlarge</p> 2401 <p id="_EnlargeP17"><span><span id="S11"></span>Test Block Enlarge<span id="E11"></span></span></p> 2387 2402 <p id="_trim_ct">Test trim</p> 2388 2403 </div> 2389 2404 <script type="text/javascript"> -
_source/tests/plugins/domiterator/domiterator.html
25 25 { 26 26 return CKEDITOR.document.getById( id ).getValue().replace(/\r/gi,''); 27 27 } 28 28 var testcases; 29 29 CKEDITOR.test.addTestCase( (function() 30 30 { 31 31 … … 99 99 arrayAssert.itemsAreEqual( expectedTagList, blockList ); 100 100 } 101 101 102 return {102 return testcases = { 103 103 104 104 /** 105 105 * Test iterating over table cells. … … 165 165 test_iterator_establish_paragraph: function() 166 166 { 167 167 var range = new CKEDITOR.dom.range(doc); 168 range.setStartAt( doc.getById('iterTarget9'), CKEDITOR.POSITION_AFTER_START);169 range.setEndAt( doc.getById('iterTarget9'), CKEDITOR.POSITION_BEFORE_END);170 assumeIterationSameAs( range, null, ['p']);171 assumeElementContentAreSame( 'iterContainer9', 'iterResult9' );168 range.setStartAt( doc.getById('iterTarget9'), CKEDITOR.POSITION_AFTER_START ); 169 range.setEndAt( doc.getById('iterTarget9'), CKEDITOR.POSITION_BEFORE_END ); 170 assumeIterationSameAs( range, null, ['p'] ); 171 assumeElementContentAreSame( 'iterContainer9', 'iterResult9' ); 172 172 }, 173 173 174 174 /** … … 185 185 name : document.title 186 186 }; 187 187 })() ); 188 188 //window.onload = testcases.test_iterator_establish_paragraph; 189 189 //]]> 190 190 </script> 191 191 </head> -
_source/core/dom/range.js
129 129 130 130 // For Extract and Clone, we must clone this level. 131 131 if ( clone && !levelStartNode.equals( startNode ) ) // action = 0 = Delete 132 levelClone = clone.append( levelStartNode.clone( false, action == 1) );132 levelClone = clone.append( levelStartNode.clone() ); 133 133 134 134 currentNode = levelStartNode.getNext(); 135 135 … … 173 173 174 174 // For Extract and Clone, we must clone this level. 175 175 if ( action > 0 && !levelStartNode.equals( endNode ) ) // action = 0 = Delete 176 levelClone = clone.append( levelStartNode.clone( false, action == 1) );176 levelClone = clone.append( levelStartNode.clone() ); 177 177 178 178 // The processing of siblings may have already been done by the parent. 179 179 if ( !startParents[ k ] || levelStartNode.$.parentNode != startParents[ k ].$.parentNode ) … … 1174 1174 walker.guard = boundaryGuard; 1175 1175 1176 1176 1177 if ( ( enlargeable = walker.lastBackward() ) ) 1178 { 1179 // It's the body which stop the enlaring if no block boundary found. 1180 blockBoundary = blockBoundary || body; 1177 enlargeable = walker.lastBackward() 1178 // It's the body which stop the enlarging if no block boundary found. 1179 blockBoundary = blockBoundary || body; 1181 1180 1182 1183 1184 1185 1186 blockBoundary.contains( enlargeable ) ?1187 CKEDITOR.POSITION_AFTER_START :1188 CKEDITOR.POSITION_AFTER_END );1189 }1181 // Start the range at different position by comparing 1182 // the document position of it with 'enlargeable' node. 1183 this.setStartAt( 1184 blockBoundary, 1185 !blockBoundary.is( 'br' ) && 1186 ( !enlargeable || blockBoundary.contains( enlargeable ) ) ? 1187 CKEDITOR.POSITION_AFTER_START : 1188 CKEDITOR.POSITION_AFTER_END ); 1190 1189 1191 1190 // Enlarging the end boundary. 1192 1191 walkerRange = this.clone(); … … 1200 1199 blockBoundary = null; 1201 1200 // End the range right before the block boundary node. 1202 1201 1203 if ( ( enlargeable = walker.lastForward() ) ) 1204 { 1205 // It's the body which stop the enlaring if no block boundary found. 1206 blockBoundary = blockBoundary || body; 1202 enlargeable = walker.lastForward() 1203 // It's the body which stop the enlarging if no block boundary found. 1204 blockBoundary = blockBoundary || body; 1207 1205 1208 1209 1210 1211 1212 blockBoundary.contains( enlargeable ) ?1213 CKEDITOR.POSITION_BEFORE_END :1214 CKEDITOR.POSITION_BEFORE_START );1215 }1206 // Start the range at different position by comparing 1207 // the document position of it with 'enlargeable' node. 1208 this.setEndAt( 1209 blockBoundary, 1210 !blockBoundary.is( 'br' ) && 1211 ( !enlargeable || blockBoundary.contains( enlargeable ) ) ? 1212 CKEDITOR.POSITION_BEFORE_END : 1213 CKEDITOR.POSITION_BEFORE_START ); 1216 1214 // We must include the <br> at the end of range if there's 1217 1215 // one and we're expanding list item contents 1218 1216 if ( tailBr )