Ticket #2156: 2156_1.patch

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

first candidate fix described in comment 7 of this ticket

  • _source/internals/fckxhtml.js

     
    5656        else
    5757                this._AppendChildNodes( this.MainNode, node, false ) ;
    5858
     59        /**
     60         * FCKXHtml._AppendNode() marks DOM element objects it has
     61         * processed by adding a property called _fckxhtmljob,
     62         * setting it equal to the value of FCKXHtml.CurrentJobNum. 
     63         * On Internet Explorer, if an element object has such a
     64         * property,  it will show up in the object's attributes
     65         * NamedNodeMap, and the corresponding Attr object in
     66         * that collection  will have is specified property set
     67         * to true.  This trips up code elsewhere that checks to
     68         * see if an element is free of attributes before proceeding
     69         * with an edit operation (c.f. FCK.Style.RemoveFromRange())
     70         *     
     71         * refs #2156 and #2834
     72         */
     73        if ( FCKBrowserInfo.IsIE )
     74                FCKXHtml._RemoveXHtmlJobProperties( node ) ;
     75
    5976        // Get the resulting XHTML as a string.
    6077        var sXHTML = this._GetMainXmlString() ;
    6178
  • _source/internals/fckxhtml_ie.js

     
    9292        }
    9393}
    9494
     95/**
     96 * Used to clean up HTML that has been processed FCKXHtml._AppendNode().
     97 *
     98 * For objects corresponding to HTML elements, Internet Explorer will
     99 * treat a property as if it were an attribute set on that element.
     100 *
     101 * http://msdn.microsoft.com/en-us/library/ms533026(VS.85).aspx#Accessing_Element_Pr
     102 *
     103 * FCKXHtml._AppendNode() sets the property _fckxhtmljob on node objects
     104 * corresponding HTML elements to mark them as having been processed.
     105 * Counting these properties as attributes will cripple style removal
     106 * because FCK.Styles.RemoveFromSelection() will not remove an element
     107 * as long as it still has attributes.
     108 *
     109 * refs #2156 and #2834
     110 */
     111
     112FCKXHtml._RemoveXHtmlJobProperties = function ( node )
     113{
     114        // Protect against degenerate cases.
     115        if ( ( typeof node !== 'object' ) || ( node === null ) )
     116                return ;
     117
     118        // Protect against being passed a non-DOMNode object.
     119        if ( typeof node.nodeType === 'undefined' )
     120                return ;
     121
     122        // Select only nodes of type ELEMENT_NODE
     123        if ( node.nodeType === 1 )
     124        {
     125       
     126                // Clear the _fckhtmljob attribute.
     127                if ( typeof node._fckxhtmljob !== 'undefined' )
     128                        node._fckhtmljob = null ;
     129
     130                // Recurse upon child nodess.
     131                if ( node.hasChildNodes() )
     132                {
     133                        var childNodes = node.childNodes ;
     134                        for ( var i = 0 ; i < childNodes.length ; ++i )
     135                                FCKXHtml._RemoveXHtmlJobProperties( childNodes.item(i) ) ;
     136                }
     137        }
     138}
     139
    95140// On very rare cases, IE is loosing the "align" attribute for DIV. (right align and apply bulleted list)
    96141FCKXHtml.TagProcessors['div'] = function( node, htmlNode )
    97142{
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy