Ticket #3529: 3529_2.patch

File 3529_2.patch, 2.5 KB (added by Garry Yao, 15 years ago)
  • core/dom/text.js

     
    7979                 */
    8080                split : function( offset )
    8181                {
    82                         // If the offset is after the last char, IE creates the text node
    83                         // on split, but don't include it into the DOM. So, we have to do
    84                         // that manually here.
    85                         if ( CKEDITOR.env.ie && offset == this.getLength() )
     82                        // @see {@link CKEDITOR.env.support.splitTextAtLastChar}.
     83                        if ( offset == this.getLength() && !CKEDITOR.env.support.splitTextAtLastChar )
    8684                        {
    8785                                var next = this.getDocument().createText( '' );
    8886                                next.insertAfter( this );
     
    9290                        var doc = this.getDocument();
    9391                        var retval = new CKEDITOR.dom.text( this.$.splitText( offset ), doc );
    9492
    95                         // IE BUG: IE8 does not update the childNodes array in DOM after splitText(),
    96                         // we need to make some DOM changes to make it update. (#3436)
    97                         if ( CKEDITOR.env.ie && CKEDITOR.env.version >= 8 )
     93                        // @see {@link CKEDITOR.env.support.splitTextUpdateChildren}.
     94                        if ( !CKEDITOR.env.support.splitTextUpdateChildren )
    9895                        {
    9996                                var workaround = new CKEDITOR.dom.text( '', doc );
    10097                                workaround.insertAfter( retval );
  • core/env.js

     
    192192                if ( env.gecko && version < 10900 )
    193193                        env.cssClass += ' cke_browser_gecko18';
    194194
     195                // Feature detections below for capabilities of native API on which we rely.
     196                var root = document.documentElement;
     197                env.support =
     198                {
     199                        // IE BUG: If the offset is after the last char, IE creates the text node
     200                        // on split, but don't include it into the DOM
     201                        splitTextAtLastChar : !env.ie,
     202
     203                        // IE BUG: IE8 and it's compatible mode does not update the childNodes
     204                        // array in DOM after splitText() util next DOM changes.
     205                        splitTextUpdateChildren : !( env.ie && env.version == 8 )
     206                                                                                && ( function()
     207                        {
     208                                var parent = document.createElement( 'p' );
     209                                parent.innerHTML = 'A B <b>C </b>D E';
     210                                root.appendChild( parent );
     211                                // Split the text nodes.
     212                                parent.firstChild.splitText( 2 );       // Right before "B"
     213                                parent.childNodes[ 3 ].splitText( 2 );  // Right before "E"
     214                                var childNums = parent.childNodes.length;
     215                                root.removeChild( parent );
     216                                return childNums == 5;
     217                        } )()
     218                };
     219
    195220                return env;
    196221        })();
    197222}
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy