Ticket #3874: 3874.patch

File 3874.patch, 3.0 KB (added by Garry Yao, 15 years ago)
  • _source/core/tools.js

    (this hunk was shorter than expected) 
     
    227227                                return span.getHtml();
    228228                        };
    229229
    230                         var fix1 = ( standard( '>' ) == '>' ) ?
     230                        var fix1 = ( standard( '\n' ).toLowerCase() == '<br>' ) ?
    231231                                function( text )
    232232                                {
     233                                        // #3874 IE and Safari encode line-break into <br>
     234                                        return standard( text ).replace( /<br>/gi, '\n' );
     235                                } :
     236                                standard;
     237
     238                        var fix2 = ( standard( '>' ) == '>' ) ?
     239                                function( text )
     240                                {
    233241                                        // WebKit does't encode the ">" character, which makes sense, but
    234242                                        // it's different than other browsers.
    235                                         return standard( text ).replace( />/g, '&gt;' );
     243                                        return fix1( text ).replace( />/g, '&gt;' );
    236244                                } :
    237                                 standard;
     245                                fix1;
    238246
    239                         var fixNbsp = /&nbsp;/g;
    240                         var fix2 = ( standard( '  ' ) == '&nbsp; ' ) ?
     247                        var fix3 = ( standard( '  ' ) == '&nbsp; ' ) ?
    241248                                function( text )
    242249                                {
    243250                                        // #3785 IE8 changes spaces (>= 2) to &nbsp;
    244                                         return fix1( text ).replace( fixNbsp, ' ' );
     251                                        return fix2( text ).replace( /&nbsp;/g, ' ' );
    245252                                } :
    246                                 fix1;
    247 
    248                         this.htmlEncode = fix2;
     253                                fix2;
     254                       
     255                        this.htmlEncode = fix3;
    249256
    250257                        return this.htmlEncode( text );
    251258                },
  • _source/tests/core/tools.html

     
    99        <script type="text/javascript" src="../test.js"></script>
    1010        <script type="text/javascript">
    1111        //<![CDATA[
    12 
    13 CKEDITOR.test.addTestCase( (function()
     12var testcase;
     13CKEDITOR.test.addTestCase( testcase = (function()
    1414{
    1515        // Local reference to the "assert" object.
    1616        var assert = CKEDITOR.test.assert;
     
    7777                        assert.areSame( 'Test\'s &amp; "quote"', CKEDITOR.tools.htmlEncode( 'Test\'s & "quote"' ) );
    7878                },
    7979
     80                test_htmlEncode_3874 : function()
     81                {
     82                        assert.areSame( 'line1\nline2', CKEDITOR.tools.htmlEncode( 'line1\nline2' ) );
     83                },
     84
    8085                test_cssStyleToDomStyle1 : function()
    8186                {
    8287                        assert.areSame( 'backgroundColor', CKEDITOR.tools.cssStyleToDomStyle( 'background-color' ) );
     
    152157                name : document.title
    153158        };
    154159})() );
    155 
     160//window.onload = testcase.test_htmlEncode_3874;
    156161        //]]>
    157162        </script>
    158163</head>
  • CHANGES.html

     
    8888                <li><a href="http://dev.fckeditor.net/ticket/3825">#3825</a> : Fixed JS error when opening spellingcheck.</li>
    8989                <li><a href="http://dev.fckeditor.net/ticket/3862">#3862</a> : Fixed html parser infinite loop on certain malformed
    9090                        source code.</li>
     91                <li><a href="http://dev.fckeditor.net/ticket/3874">#3874</a> : Paste as plain text in Safari loosing lines.</li>
    9192        </ul>
    9293        <h3>
    9394                CKEditor 3.0 RC</h3>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy