Ticket #9152: 9152_2.patch

File 9152_2.patch, 3.4 KB (added by Garry Yao, 12 years ago)
  • _source/core/dom/range.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    351351        {
    352352                var skipBogus = false,
    353353                        bookmarkEvaluator = CKEDITOR.dom.walker.bookmark( true ),
    354                         nbspRegExp = /^[\t\r\n ]*(?:&nbsp;|\xa0)$/;
     354                        isBogus = CKEDITOR.dom.walker.bogus();
    355355
    356356                return function( node )
    357357                {
     
    359359                        if ( bookmarkEvaluator( node ) )
    360360                                return true;
    361361
    362                         if ( node.type == CKEDITOR.NODE_TEXT )
     362                        // Skip the bogus node at the end of block.
     363                        if ( isBogus( node ) &&
     364                                 ( node.type == CKEDITOR.NODE_TEXT || !isStart ) &&
     365                                 !skipBogus )
    363366                        {
    364                                 // Skip the block filler NBSP.
    365                                 if ( CKEDITOR.env.ie &&
    366                                          nbspRegExp.test( node.getText() ) &&
    367                                          !skipBogus &&
    368                                          !( isStart && node.getNext() ) )
    369                                 {
    370                                         skipBogus = true;
    371                                 }
    372                                 // If there's any visible text, then we're not at the start.
    373                                 else if ( node.hasAscendant( 'pre' ) || CKEDITOR.tools.trim( node.getText() ).length )
    374                                         return false;
    375                         }
    376                         else if ( node.type == CKEDITOR.NODE_ELEMENT )
    377                         {
    378                                 // If there are non-empty inline elements (e.g. <img />), then we're not
    379                                 // at the start.
    380                                 if ( !inlineChildReqElements[ node.getName() ] )
    381                                 {
    382                                         // Skip the padding block br.
    383                                         if ( !CKEDITOR.env.ie &&
    384                                                  node.is( 'br' ) &&
    385                                                  !skipBogus &&
    386                                                  !( isStart && node.getNext() ) )
    387                                         {
    388                                                 skipBogus = true;
    389                                         }
    390                                         else
    391                                                 return false;
    392                                 }
    393                         }
     367                                skipBogus = true;
     368                                return true;
     369                        }
     370
     371                        // If there's any visible text, then we're not at the start.
     372                        if ( node.type == CKEDITOR.NODE_TEXT &&
     373                                         ( node.hasAscendant( 'pre' ) ||
     374                                                 CKEDITOR.tools.trim( node.getText() ).length ) )
     375                                return false;
     376
     377                        // If there are non-empty inline elements (e.g. <img />), then we're not
     378                        // at the start.
     379                        if ( node.type == CKEDITOR.NODE_ELEMENT && !inlineChildReqElements[ node.getName() ] )
     380                                return false;
     381
    394382                        return true;
    395383                };
    396384        }
     
    18341822                        var startContainer = this.startContainer,
    18351823                                startOffset = this.startOffset;
    18361824
    1837                         // If the starting node is a text node, and non-empty before the offset,
    1838                         // then we're surely not at the start of block.
    1839                         if ( startOffset && startContainer.type == CKEDITOR.NODE_TEXT )
    1840                         {
    1841                                 var textBefore = CKEDITOR.tools.ltrim( startContainer.substring( 0, startOffset ) );
    1842                                 if ( textBefore.length )
    1843                                         return false;
    1844                         }
    1845 
    18461825                        // We need to grab the block element holding the start boundary, so
    18471826                        // let's use an element path for it.
    18481827                        var path = new CKEDITOR.dom.elementPath( this.startContainer );
     
    18601839
    18611840                checkEndOfBlock : function()
    18621841                {
    1863                         var endContainer = this.endContainer,
    1864                                 endOffset = this.endOffset;
    1865 
    1866                         // If the ending node is a text node, and non-empty after the offset,
    1867                         // then we're surely not at the end of block.
    1868                         if ( endContainer.type == CKEDITOR.NODE_TEXT )
    1869                         {
    1870                                 var textAfter = CKEDITOR.tools.rtrim( endContainer.substring( endOffset ) );
    1871                                 if ( textAfter.length )
    1872                                         return false;
    1873                         }
    1874 
    18751842                        // We need to grab the block element holding the start boundary, so
    18761843                        // let's use an element path for it.
    18771844                        var path = new CKEDITOR.dom.elementPath( this.endContainer );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy