Skip to content

Commit

Permalink
Fix forceSimpleAmpersand config implementation
Browse files Browse the repository at this point in the history
Run ampersand replacement after the  htmlEncodeAttr, otherwise the results are overwritten (ckeditor/ckeditor4#965)
  • Loading branch information
alexmaris authored and mlewand committed Sep 14, 2018
1 parent 7632f5c commit febd1d6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugin.js
Expand Up @@ -179,9 +179,11 @@ CKEDITOR.htmlWriter = CKEDITOR.tools.createClass( {
attribute: function( attName, attValue ) {

if ( typeof attValue == 'string' ) {
this.forceSimpleAmpersand && ( attValue = attValue.replace( /&/g, '&' ) );
// Browsers don't always escape special character in attribute values. (https://dev.ckeditor.com/ticket/4683, https://dev.ckeditor.com/ticket/4719).
attValue = CKEDITOR.tools.htmlEncodeAttr( attValue );

// Run ampersand replacement after the htmlEncodeAttr, otherwise the results are overwritten (https://github.com/ckeditor/ckeditor-dev/issues/965)
this.forceSimpleAmpersand && ( attValue = attValue.replace( /&/g, '&' ) );
}

this._.output.push( ' ', attName, '="', attValue, '"' );
Expand Down

0 comments on commit febd1d6

Please sign in to comment.