Ticket #7494: 7494.patch

File 7494.patch, 2.5 KB (added by Sa'ar Zac Elias, 13 years ago)
  • _source/core/htmlparser/fragment.js

     
    112112                }
    113113
    114114                /*
    115                 * Beside of simply append specified element to target, this function also takes
     115                * Beside of simply append specified element to target, it also takes
    116116                * care of other dirty lifts like forcing block in body, trimming spaces at
    117117                * the block boundaries etc.
    118                 *
     118                * 
    119119                * @param {Element} element  The element to be added as the last child of {@link target}.
    120120                * @param {Element} target The parent element to relieve the new node.
    121                 * @param {Boolean} [moveCurrent=false] Don't change the "currentNode" global unless
    122                 * there's a return point node specified on the element, otherwise move current onto {@link target} node.
    123121                 */
    124                 function addElement( element, target, moveCurrent )
     122                function addElement( element, target )
    125123                {
    126124                        // Ignore any element that has already been added.
    127125                        if ( element.previous !== undefined )
     
    181179                                delete element.returnPoint;
    182180                        }
    183181                        else
    184                                 currentNode = moveCurrent ? target : savedCurrent;
     182                                currentNode = savedCurrent;
    185183                }
    186184
    187185                parser.onTagOpen = function( tagName, attributes, selfClosing )
     
    260258                                                // The most common case where we just need to close the
    261259                                                // current one and append the new one to the parent.
    262260                                                if ( currentNode.parent )
    263                                                         addElement( currentNode, currentNode.parent, 1 );
     261                                                {
     262                                                        addElement( currentNode, currentNode.parent );
     263                                                        currentNode = currentNode.parent;
     264                                                }
    264265                                                // We've tried our best to fix the embarrassment here, while
    265266                                                // this element still doesn't find it's parent, mark it as
    266267                                                // orphan and show our tolerance to it.
     
    398399                // Send all pending BRs except one, which we consider a unwanted bogus. (#5293)
    399400                sendPendingBRs( !CKEDITOR.env.ie && 1 );
    400401
    401                 // Close all pending nodes, make sure return point is properly restored.
     402                // Close all pending nodes.
    402403                while ( currentNode != fragment )
    403                         addElement( currentNode, currentNode.parent, 1 );
     404                {
     405                        // Make sure return point is properly restored.
     406                        var returnPoint = currentNode.returnPoint;
     407                        addElement( currentNode, currentNode.parent );
     408                        currentNode = returnPoint || currentNode.parent;
     409                }
    404410
    405411                return fragment;
    406412        };
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy