replaceAll() requires a global regex

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2023-07-24 18:29:18 +02:00
parent 75e9a5921e
commit f0973ce32b
2 changed files with 3 additions and 3 deletions

View File

@@ -30,7 +30,7 @@ function escapeHtml(text) {
// Return early when text is not a string
if (typeof text !== "string") return text;
return text.replaceAll(/[&<>"']/, function (m) {
return text.replaceAll(/[&<>"']/g, function (m) {
return map[m];
});
}
@@ -54,7 +54,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];
}