Ticket #4079: 4079.patch

File 4079.patch, 2.4 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/wysiwygarea/plugin.js

     
    189189
    190190                // Inserting the padding-br before body if it's preceded by an
    191191                // unexitable block.
    192                 var lastNode = body.getLast( true );
     192                var lastNode = body.getLast( CKEDITOR.dom.walker.whitespaces( true ) );
    193193                if ( lastNode && lastNode.getName && ( lastNode.getName() in nonExitableElementNames ) )
    194194                {
    195195                        var paddingBlock = editor.document.createElement(
  • _source/core/dom/element.js

     
    644644                },
    645645
    646646                /**
    647                  * @param ignoreEmpty Skip empty text nodes.
     647                 * @param {Function} evaluator Filtering the result node.
    648648                 */
    649                 getLast : function( ignoreEmpty )
     649                getLast : function( evaluator )
    650650                {
    651                         var $ = this.$.lastChild;
    652                         if ( ignoreEmpty && $ && ( $.nodeType == CKEDITOR.NODE_TEXT )
    653                                         && !CKEDITOR.tools.trim( $.nodeValue ) )
    654                                 return new CKEDITOR.dom.node( $ ).getPrevious( true );
    655                         else
    656                                 return $ ? new CKEDITOR.dom.node( $ ) : null;
     651                        var last = this.$.lastChild,
     652                                retval = last && new CKEDITOR.dom.node( last );
     653                        if ( retval && evaluator && !evaluator( retval ) )
     654                                retval = retval.getPrevious( evaluator );
     655
     656                        return retval;
    657657                },
    658658
    659659                getStyle : function( name )
  • _source/tests/core/dom/element.html

     
    524524                        }
    525525                },
    526526
     527                // Test get last non-spaces child node.
     528                test_getLast : function()
     529                {
     530                        var element = new CKEDITOR.dom.element( document.getElementById( 'append' ) );
     531                        var span1 = new CKEDITOR.dom.element( 'span' );
     532                        element.append( span1 );
     533                        element.append( new CKEDITOR.dom.text( ' ' ) );
     534                        element.append( new CKEDITOR.dom.text( ' ' ) );
     535                        var last = element.getLast( CKEDITOR.dom.walker.whitespaces( true ) );
     536                        assert.areSame( span1.$, last.$ );
     537                },
     538
     539
    527540                name : document.title
    528541        };
    529542})() );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy