Ticket #4690: 4690_2.patch

File 4690_2.patch, 1.7 KB (added by Garry Yao, 14 years ago)
  • _source/core/htmlparser/fragment.js

     
    264264
    265265                parser.onTagClose = function( tagName )
    266266                {
    267                         var index = 0,
     267                        var index = pendingInline.length - 1,
    268268                                pendingAdd = [],
    269269                                candidate = currentNode;
    270270
     
    273273                                // If this is an inline element, add it to the pending list, so
    274274                                // it will continue after the closing tag.
    275275                                if ( !candidate._.isBlockLike )
    276                                 {
    277                                         pendingInline.unshift( candidate );
     276                                        pendingInline.push( candidate );
    278277
    279                                         // Increase the index, so it will not get checked again in
    280                                         // the pending list check that follows.
    281                                         index++;
    282                                 }
    283 
    284278                                // This node should be added to it's parent at this point. But,
    285279                                // it should happen only if the closing tag is really closing
    286280                                // one of the nodes. So, for now, we just cache it.
     
    313307                        // The tag is not actually closing anything, thus we need invalidate
    314308                        // the pending elements.(#3862)
    315309                        else
    316                         {
    317                                 pendingInline.splice( 0, index );
    318                                 index = 0;
    319                         }
     310                                pendingInline.length = index + 1;
    320311
    321                         // Check if there is any pending tag to be closed.
    322                         for ( ; index < pendingInline.length ; index++ )
     312                        // Check if there is one pending tag to be closed.
     313                        for ( ; index >= 0 ; index-- )
    323314                        {
    324315                                // If found, just remove it from the list.
    325316                                if ( tagName == pendingInline[ index ].name )
    326317                                {
    327318                                        pendingInline.splice( index, 1 );
    328 
    329                                         // Decrease the index so we continue from the next one.
    330                                         index--;
     319                                        break;
    331320                                }
    332321                        }
    333322                };
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy