Ticket #4150: 4150.patch

File 4150.patch, 6.2 KB (added by Garry Yao, 15 years ago)
  • _source/tests/core/dom/range.html

     
    10591059                        assert.isTrue( range.collapsed, 'range.collapsed' );
    10601060                },
    10611061
     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
    10621076                test_deleteContents_W3C_1 : function()
    10631077                {
    10641078                        // W3C DOM Range Specs - Section 2.6 - Example 1
     
    23842398                <p id="_EnlargeP14"><span id="S8"></span></p>
    23852399                <p id="_EnlargeP15">Test <span id="S9"></span>List<br/ >Item Enlarge</p>
    23862400                <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>
    23872402                <p id="_trim_ct">Test trim</p>
    23882403        </div>
    23892404        <script type="text/javascript">
  • _source/tests/plugins/domiterator/domiterator.html

     
    2525{
    2626        return CKEDITOR.document.getById( id ).getValue().replace(/\r/gi,'');
    2727}
    28 
     28var testcases;
    2929CKEDITOR.test.addTestCase( (function()
    3030{
    3131
     
    9999                arrayAssert.itemsAreEqual( expectedTagList, blockList );
    100100        }
    101101
    102         return {
     102        return testcases = {
    103103
    104104                /**
    105105                 * Test iterating over table cells.
     
    165165                test_iterator_establish_paragraph: function()
    166166                {
    167167                        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' );
    172172                },
    173173
    174174                /**
     
    185185                name : document.title
    186186        };
    187187})() );
    188 
     188//window.onload = testcases.test_iterator_establish_paragraph;
    189189        //]]>
    190190        </script>
    191191</head>
  • _source/core/dom/range.js

     
    129129
    130130                        // For Extract and Clone, we must clone this level.
    131131                        if ( clone && !levelStartNode.equals( startNode ) )             // action = 0 = Delete
    132                                 levelClone = clone.append( levelStartNode.clone( false, action == 1 ) );
     132                                levelClone = clone.append( levelStartNode.clone() );
    133133
    134134                        currentNode = levelStartNode.getNext();
    135135
     
    173173
    174174                        // For Extract and Clone, we must clone this level.
    175175                        if ( action > 0 && !levelStartNode.equals( endNode ) )          // action = 0 = Delete
    176                                 levelClone = clone.append( levelStartNode.clone( false, action == 1 ) );
     176                                levelClone = clone.append( levelStartNode.clone() );
    177177
    178178                        // The processing of siblings may have already been done by the parent.
    179179                        if ( !startParents[ k ] || levelStartNode.$.parentNode != startParents[ k ].$.parentNode )
     
    11741174                                        walker.guard = boundaryGuard;
    11751175
    11761176
    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;
    11811180
    1182                                                 // Start the range at different position by comparing
    1183                                                 // the document position of it with 'enlargeable' node.
    1184                                                 this.setStartAt(
    1185                                                                 blockBoundary,
    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 );
    11901189
    11911190                                        // Enlarging the end boundary.
    11921191                                        walkerRange = this.clone();
     
    12001199                                        blockBoundary = null;
    12011200                                        // End the range right before the block boundary node.
    12021201
    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;
    12071205
    1208                                                 // Start the range at different position by comparing
    1209                                                 // the document position of it with 'enlargeable' node.
    1210                                                 this.setEndAt(
    1211                                                                 blockBoundary,
    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 );
    12161214                                        // We must include the <br> at the end of range if there's
    12171215                                        // one and we're expanding list item contents
    12181216                                        if ( tailBr )
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy