replaceAll() requires a global regex (#2653)

This commit is contained in:
Adam Warner
2023-07-24 18:28:15 +01:00
committed by GitHub
+2 -2
View File
@@ -19,7 +19,7 @@ function escapeHtml(text) {
if (text === null) return null;
return text.replaceAll(/[&<>"']/, function (m) {
return text.replaceAll(/[&<>"']/g, function (m) {
return map[m];
});
}
@@ -43,7 +43,7 @@ function unescapeHtml(text) {
if (text === null) return null;
return text.replaceAll(
/&(?:amp|lt|gt|quot|#039|Uuml|uuml|Auml|auml|Ouml|ouml|szlig);/,
/&(?:amp|lt|gt|quot|#039|Uuml|uuml|Auml|auml|Ouml|ouml|szlig);/g,
function (m) {
return map[m];
}