Ticket #3801: 3801_5.patch

File 3801_5.patch, 4.3 KB (added by Tobiasz Cudnik, 15 years ago)
  • CHANGES.html

     
    7878                <li><a href="http://dev.fckeditor.net/ticket/3829">#3829</a> : Fixed remove empty link on output data.</li>
    7979                <li><a href="http://dev.fckeditor.net/ticket/3730">#3730</a> : Indent is performing on the whole
    8080                        block instead of selected lines in enterMode = BR.</li>
     81                <li><a href="http://dev.fckeditor.net/ticket/3801">#3801</a> : Comments at the start of the document was lost in IE.</li>
    8182        </ul>
    8283        <h3>
    8384                CKEditor 3.0 RC</h3>
  • _source/tests/plugins/htmldataprocessor/htmldataprocessor.html

     
    270270                                dataProcessor.toDataFormat( protectedHtml ) );
    271271                },
    272272
     273                test_innerHtmlComments_ticket_3801 : function()
     274                {
     275                        var editor = CKEDITOR.instances.editor1,
     276                                dataProcessor = editor.dataProcessor;
    273277
     278                        dataProcessor.writer = new CKEDITOR.htmlParser.basicWriter();
     279
     280                        for ( var i = 1; i <= 6; i++ )
     281                        {
     282                                var html = getTextAreaValue( '_TEXTAREA_3801_' + i );
     283                                var protectedHtml = dataProcessor.toHtml( html );
     284
     285                                assert.areSame( getTextAreaValue( '_TEXTAREA_3801_' + i ),
     286                                        dataProcessor.toDataFormat( protectedHtml ) );
     287                        }
     288                },
     289
     290
    274291                name : document.title
    275292        };
    276293})() );
     
    290307        <textarea id="_TEXTAREA_3591"><object><param /><param /><embed></embed></object></textarea>
    291308        <textarea id="_TEXTAREA_3591_protected"><cke:object><cke:param></cke:param><cke:param></cke:param><cke:embed></cke:embed></cke:object></textarea>
    292309        <textarea id="_TEXTAREA_3591_2"><object classid="clsid"><param name="movie" value="movie.swf" /><embed src="movie.swf" type="application/x-shockwave-flash"></embed></object></textarea>
     310        <textarea id="_TEXTAREA_3801_1"><!-- foo --><p>bar</p></textarea>
     311        <textarea id="_TEXTAREA_3801_2"><p><!-- foo -->bar</p></textarea>
     312        <textarea id="_TEXTAREA_3801_3"><!-- foo --><p><!-- foo -->bar</p></textarea>
     313        <textarea id="_TEXTAREA_3801_4"><p>bar</p><!-- foo --></textarea>
     314        <textarea id="_TEXTAREA_3801_5">bar<!-- foo --></textarea>
     315        <textarea id="_TEXTAREA_3801_6"><!-- foo -->bar</textarea>
    293316</body>
    294317</html>
  • _source/plugins/htmldataprocessor/plugin.js

     
    195195                return html.replace( protectAttributeRegex, '$& _cke_saved_$1' );
    196196        }
    197197
    198         var protectStyleTagsRegex = /<(style)(?=[ >])[^>]*>[^<]*<\/\1>/gi;
     198        var protectTagsRegex = /<(style)(?=[ >])[^>]*>[^<]*<\/\1>|<!--([\s\S]*?)-->/gi;
    199199        var encodedTagsRegex = /<cke:encoded>([^<]*)<\/cke:encoded>/gi;
    200200        var protectElementNamesRegex = /(<\/?)((?:object|embed|param).*?>)/gi;
    201201        var protectSelfClosingRegex = /<cke:param(.*?)\/>/gi;
    202202
    203         function protectStyleTagsMatch( match )
     203        function protectTagsMatch( match )
    204204        {
    205205                return '<cke:encoded>' + encodeURIComponent( match ) + '</cke:encoded>';
    206206        }
    207207
    208         function protectStyleTags( html )
     208        function protectTags( html )
    209209        {
    210                 return html.replace( protectStyleTagsRegex, protectStyleTagsMatch );
     210                return html.replace( protectTagsRegex, protectTagsMatch );
    211211        }
    212212        function protectElementsNames( html )
    213213        {
     
    296296                        // the code.
    297297                        data = protectAttributes( data );
    298298
    299                         // IE remvoes style tags from innerHTML. (#3710).
     299                        // IE remvoes style tags an comments from innerHTML. (#3710 & #3801).
    300300                        if ( CKEDITOR.env.ie )
    301                                 data = protectStyleTags( data );
     301                                data = protectTags( data );
    302302
    303303                        // Certain elements has problem to go through DOM operation, protect
    304304                        // them by prefixing 'cke' namespace.(#3591)
     
    310310
    311311                        // Call the browser to help us fixing a possibly invalid HTML
    312312                        // structure.
    313                         var div = document.createElement( 'div' );
    314                         div.innerHTML = data;
    315                         data = div.innerHTML;
     313                        var div = new CKEDITOR.dom.element( 'div' );
     314                        div.setHtml( data );
     315                        data = div.getHtml();
    316316
    317317                        if ( CKEDITOR.env.ie )
    318318                                data = unprotectEncodedTags( data );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy