Ticket #7070: 7070_3.patch

File 7070_3.patch, 1.3 KB (added by Garry Yao, 13 years ago)
  • _source/core/dom/walker.js

     
    430430        };
    431431
    432432        var tailNbspRegex = /^[\t\r\n ]*(?: |\xa0)$/,
    433                 isNotWhitespaces = CKEDITOR.dom.walker.whitespaces( 1 ),
    434                 isNotBookmark = CKEDITOR.dom.walker.bookmark( 0, 1 ),
    435                 fillerEvaluator = function( element )
     433                isWhitespaces = CKEDITOR.dom.walker.whitespaces(),
     434                isBookmark = CKEDITOR.dom.walker.bookmark(),
     435                toSkip = function( node )
    436436                {
    437                         return isNotBookmark( element ) && isNotWhitespaces( element );
     437                        return isBookmark( node )
     438                                        || isWhitespaces( node )
     439                                        || node.type == CKEDITOR.NODE_ELEMENT && node.getName() in CKEDITOR.dtd.$removeEmpty;
    438440                };
    439441
    440442        // Check if there's a filler node at the end of an element, and return it.
    441443        CKEDITOR.dom.element.prototype.getBogus = function()
    442444        {
    443                 var tail = this.getLast( fillerEvaluator );
     445                // Bogus are not always at the block end, e.g. <p><strong>text<br /></strong></p> (#7070).
     446                var tail = this;
     447                do { tail = tail.getPreviousSourceNode(); }
     448                while ( toSkip( tail ) )
     449
    444450                if ( tail && ( !CKEDITOR.env.ie ? tail.is && tail.is( 'br' )
    445451                                : tail.getText && tailNbspRegex.test( tail.getText() ) ) )
    446452                {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy