Skip to content

Commit

Permalink
Remove now unused 'preserve_entities' option on escapeXml.
Browse files Browse the repository at this point in the history
This was formerly used (incorrectly) in the HTML renderer.
It isn't needed any more.

[API change]
  • Loading branch information
jgm committed Mar 21, 2019
1 parent c89b35c commit 562b867
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ var XMLSPECIAL = '[&<>"]';

var reXmlSpecial = new RegExp(XMLSPECIAL, 'g');

var reXmlSpecialOrEntity = new RegExp(ENTITY + '|' + XMLSPECIAL, 'gi');

var unescapeChar = function(s) {
if (s.charCodeAt(0) === C_BACKSLASH) {
return s.charAt(1);
Expand Down Expand Up @@ -80,13 +78,9 @@ var replaceUnsafeChar = function(s) {
}
};

var escapeXml = function(s, preserve_entities) {
var escapeXml = function(s) {
if (reXmlSpecial.test(s)) {
if (preserve_entities) {
return s.replace(reXmlSpecialOrEntity, replaceUnsafeChar);
} else {
return s.replace(reXmlSpecial, replaceUnsafeChar);
}
return s.replace(reXmlSpecial, replaceUnsafeChar);
} else {
return s;
}
Expand Down

0 comments on commit 562b867

Please sign in to comment.