Ticket #4719: 4719_5.patch

File 4719_5.patch, 2.2 KB (added by Minh Nguyen, 14 years ago)
  • _source/core/htmlparser/basicwriter.js

     
    6060                 */
    6161                attribute : function( attName, attValue )
    6262                {
    63                         // Browsers don't always escape quote in attribute values. (#4683)
    64                         if ( typeof attValue == 'string' )
    65                                 attValue = attValue.replace( /"/g, '"' );
     63                        // Browsers don't always escape special character in attribute values. (#4683, #4719).
     64                        if ( typeof attValue == 'string' ) {
     65                                attValue = CKEDITOR.tools.htmlEncodeAttr( attValue );
     66                        }
    6667
    6768                        this._.output.push( ' ', attName, '="', attValue, '"' );
    6869                },
  • _source/core/tools.js

     
    321321
    322322                        return this.htmlEncode( text );
    323323                },
     324               
     325                /**
     326                 * Replace special HTML characters in a string with their relative HTML
     327                 * entity values.
     328                 * @param {String} text The string to be encoded.
     329                 * @returns {String} The encode string.
     330                 * @example
     331                 * alert( CKEDITOR.tools.htmlEncode( 'A > " < D' ) );  // "A &gt; &quote; &lt; D"
     332                 */
     333               
     334                htmlEncodeAttr : function( text )
     335                {
     336                        return text.replace( /"/g, '&quot;' ).replace( /</g, '&lt;' ).replace( />/, '&gt;' );
     337                },
    324338
    325339                /**
    326340                 * Replace characters can't be represented through CSS Selectors string
  • _source/plugins/htmlwriter/plugin.js

     
    175175                        if ( typeof attValue == 'string' )
    176176                        {
    177177                                this.forceSimpleAmpersand && ( attValue = attValue.replace( /&amp;/g, '&' ) );
    178                                 // Browsers don't always escape quote in attribute values. (#4683)
    179                                 attValue = attValue.replace( /"/g, '&quot;' );
     178                                // Browsers don't always escape special character in attribute values. (#4683, #4719).
     179                                attValue = CKEDITOR.tools.htmlEncodeAttr( attValue );
    180180                        }
    181181
    182182                        this._.output.push( ' ', attName, '="', attValue, '"' );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy