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#965)
  • Loading branch information
alexmaris committed Sep 26, 2017
1 parent a0ba16d commit 48d6201
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/htmlwriter/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. (http://dev.ckeditor.com/ticket/4683, http://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

1 comment on commit 48d6201

@j-koehler
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this changes solve ckeditor#965 for you?

Please sign in to comment.