Ticket #2156: 2156_2.patch

File 2156_2.patch, 2.3 KB (added by P.J. Hinton, 15 years ago)

second candidate fix described in comment 7 of this ticket

  • _source/internals/fckdomtools.js

     
    488488
    489489                for ( var i = 0 ; i < attributes.length ; i++ )
    490490                {
    491                         if ( FCKBrowserInfo.IsIE && attributes[i].nodeName == 'class' )
     491                        if ( FCKBrowserInfo.IsIE )
    492492                        {
    493                                 // IE has a strange bug. If calling removeAttribute('className'),
    494                                 // the attributes collection will still contain the "class"
    495                                 // attribute, which will be marked as "specified", even if the
    496                                 // outerHTML of the element is not displaying the class attribute.
    497                                 // Note : I was not able to reproduce it outside the editor,
    498                                 // but I've faced it while working on the TC of #1391.
    499                                 if ( element.className.length > 0 )
    500                                         return true ;
     493
     494                                var attributeNodeName = attributes[i].nodeName ;
     495
     496                                if ( attributeNodeName.StartsWith( '_fck' ) )
     497                                {
     498                                        /**
     499                                         * There are places in the FCKeditor code where HTML element objects
     500                                         * get values stored as properties (e.g. _fckxhtmljob).  In Internet
     501                                         * Explorer, these are interpreted as attempts to set attributes on
     502                                         * the element. 
     503                                         *
     504                                         * http://msdn.microsoft.com/en-us/library/ms533026(VS.85).aspx#Accessing_Element_Pr
     505                                         *
     506                                         * Counting these as HTML attributes cripples
     507                                         * FCK.Style.RemoveFromRange() once FCK.GetData() has been called.
     508                                         *
     509                                         * The above conditional prevents these internal properties being
     510                                         * counted as attributes.
     511                                         *
     512                                         * refs #2156 and #2834
     513                                         */
     514
     515                                        continue ;
     516                                }
     517
     518                                if ( attributeNodeName == 'class' )
     519                                {
     520                                        // IE has a strange bug. If calling removeAttribute('className'),
     521                                        // the attributes collection will still contain the "class"
     522                                        // attribute, which will be marked as "specified", even if the
     523                                        // outerHTML of the element is not displaying the class attribute.
     524                                        // Note : I was not able to reproduce it outside the editor,
     525                                        // but I've faced it while working on the TC of #1391.
     526                                        if ( element.className.length > 0 )
     527                                                return true ;
     528                                }
    501529                        }
    502530                        else if ( attributes[i].specified )
    503531                                return true ;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy