Ticket #1989: 1989.patch

File 1989.patch, 2.8 KB (added by Martin Kou, 16 years ago)
  • _whatsnew.html

     
    5858                        mode.</li>
    5959                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1934">#1934</a>] Fixed
    6060                        JavaScript errors when calling Selection.EnsureSelection() in dialogs.</li>
     61                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1981">#1981</a>]
     62                        [<a target="_blank" href="http://dev.fckeditor.net/ticket/1989">#1989</a>] Fixed
     63                        XHTML source formatting errors in non-IE browsers.</li>
    6164        </ul>
    6265        <h3>
    6366                Version 2.6 Beta 1</h3>
  • editor/_source/internals/fcktools_gecko.js

     
    120120                case 'DOMDocument' :
    121121                        // Originaly, we were had the following here:
    122122                        // return document.implementation.createDocument( '', '', null ) ;
    123                         //
    124                         // But, when manipulating document.domain (#123), we had
    125                         // "Permission denied" errors when trying to call methods inside
    126                         // the returned object. To avoid it, we have to change to the
    127                         // following, by implementing a "custom" DOM document object, which
    128                         // includes the methods that are useful for us.
    129 
    130                         var domDoc = document.createDocumentFragment() ;
    131 
    132                         domDoc.createElement = function( name )
    133                         {
    134                                 return document.createElement( name ) ;
    135                         }
    136 
    137                         domDoc.createTextNode = function( text )
    138                         {
    139                                 return document.createTextNode( text ) ;
    140                         }
    141 
    142                         domDoc.createAttribute = function( attName )
    143                         {
    144                                 return document.createAttribute( attName ) ;
    145                         }
    146 
    147                         domDoc.createComment = function( text )
    148                         {
    149                                 return document.createComment( text ) ;
    150                         }
    151 
    152                         return domDoc ;
     123                        // But that doesn't work if we're running under domain relaxation mode, so we need a workaround.
     124                        // See http://ajaxian.com/archives/xml-messages-with-cross-domain-json about the trick we're using.
     125                        var doc = ( new DOMParser() ).parseFromString( '<tmp></tmp>', 'text/xml' ) ;
     126                        FCKDomTools.RemoveNode( doc.firstChild ) ;
     127                        return doc ;
    153128        }
    154129        return null ;
    155130}
  • editor/_source/internals/fckxhtml_gecko.js

     
    2424
    2525FCKXHtml._GetMainXmlString = function()
    2626{
    27         return '<xhtml>' + this.MainNode.innerHTML + '</xhtml>' ;
     27        return ( new XMLSerializer() ).serializeToString( this.MainNode ) ;
    2828}
    2929
    3030FCKXHtml._AppendAttributes = function( xmlNode, htmlNode, node )
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy