Ticket #6771: 6771.patch

File 6771.patch, 3.7 KB (added by Garry Yao, 13 years ago)
  • _source/core/htmlparser/fragment.js

     
    6464                        html = [],
    6565                        fragment = new CKEDITOR.htmlParser.fragment(),
    6666                        pendingInline = [],
    67                         pendingBRs = [],
    6867                        currentNode = fragment,
    6968                    // Indicate we're inside a <pre> element, spaces should be touched differently.
    7069                        inPre = false,
     
    7271
    7372                function checkPending( newTagName )
    7473                {
    75                         var pendingBRsSent;
    76 
    7774                        if ( pendingInline.length > 0 )
    7875                        {
    7976                                for ( var i = 0 ; i < pendingInline.length ; i++ )
     
    8582
    8683                                        if ( ( !currentDtd || currentDtd[ pendingName ] ) && ( !newTagName || !pendingDtd || pendingDtd[ newTagName ] || !CKEDITOR.dtd[ newTagName ] ) )
    8784                                        {
    88                                                 if ( !pendingBRsSent )
    89                                                 {
    90                                                         sendPendingBRs();
    91                                                         pendingBRsSent = 1;
    92                                                 }
    93 
    9485                                                // Get a clone for the pending element.
    9586                                                pendingElement = pendingElement.clone();
    9687
     
    10899                        }
    109100                }
    110101
    111                 function sendPendingBRs( brsToIgnore )
    112                 {
    113                         while ( pendingBRs.length - ( brsToIgnore || 0 ) > 0 )
    114                                 currentNode.add( pendingBRs.shift() );
    115                 }
    116 
    117102                function addElement( element, target, enforceCurrent )
    118103                {
    119104                        target = target || currentNode || fragment;
     
    196181                                return;
    197182                        }
    198183
    199                         if ( tagName == 'br' )
    200                         {
    201                                 pendingBRs.push( element );
    202                                 return;
    203                         }
    204 
    205184                        var currentName = currentNode.name;
    206185
    207186                        var currentDtd = currentName
     
    280259                        }
    281260
    282261                        checkPending( tagName );
    283                         sendPendingBRs();
    284262
    285263                        element.parent = currentNode;
    286264                        element.returnPoint = returnPoint;
     
    339317                                if ( currentNode.name == 'pre' )
    340318                                        inPre = false;
    341319
    342                                 if ( candidate._.isBlockLike )
    343                                         sendPendingBRs();
    344 
    345320                                addElement( candidate, candidate.parent );
    346321
    347322                                // The parent should start receiving new nodes now, except if
     
    367342                                        return;
    368343                        }
    369344
    370                         sendPendingBRs();
    371345                        checkPending();
    372346
    373347                        if ( fixForBody
     
    399373                // Parse it.
    400374                parser.parse( fragmentHtml );
    401375
    402                 // Send all pending BRs except one, which we consider a unwanted bogus. (#5293)
    403                 sendPendingBRs( !CKEDITOR.env.ie && 1 );
    404 
    405376                // Close all pending nodes.
    406377                while ( currentNode.type )
    407378                {
  • _source/core/dom/range.js

     
    922922                                                                // If this is a visible element.
    923923                                                                // We need to check for the bookmark attribute because IE insists on
    924924                                                                // rendering the display:none nodes we use for bookmarks. (#3363)
    925                                                                 if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_cke_bookmark' ) )
     925                                                                // <br> is invisible, don't miss it. (#4886)
     926                                                                if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_cke_bookmark' ) || sibling.is( 'br' ) )
    926927                                                                {
    927928                                                                        // We'll accept it only if we need
    928929                                                                        // whitespace, and this is an inline
     
    10811082                                                                // If this is a visible element.
    10821083                                                                // We need to check for the bookmark attribute because IE insists on
    10831084                                                                // rendering the display:none nodes we use for bookmarks. (#3363)
    1084                                                                 if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_cke_bookmark' ) )
     1085                                                                // <br> is invisible, don't miss it. (#4886)
     1086                                                                if ( sibling.$.offsetWidth > 0 && !sibling.getAttribute( '_cke_bookmark' ) || sibling.is( 'br' ) )
    10851087                                                                {
    10861088                                                                        // We'll accept it only if we need
    10871089                                                                        // whitespace, and this is an inline
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy