diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-12-29 16:02:01 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-12-30 13:23:08 -0400 |
commit | 8923fc4086ed66fa888edc6165c65e50c6afd94a (patch) | |
tree | 33c95b6806bfd41b6b34c7529579edd98f722c83 /src | |
parent | ec1ab18897d8dcd20d13fa5b5e1096b80a21ce95 (diff) |
data: language: support preserving value type in #sanitizeStringArg
Behind an option, for now.
Diffstat (limited to 'src')
-rw-r--r-- | src/data/things/language.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/data/things/language.js b/src/data/things/language.js index 4481af55..27bee3e4 100644 --- a/src/data/things/language.js +++ b/src/data/things/language.js @@ -255,7 +255,7 @@ export class Language extends Thing { // treated by the browser as a tag. This does *not* have an effect on actual // html.Tag objects, which are treated as sanitized by default (so that they // can be nested inside strings at all). - #sanitizeStringArg(arg) { + #sanitizeStringArg(arg, {preserveType = false} = {}) { const escapeHTML = CacheableObject.getUpdateValue(this, 'escapeHTML'); if (!escapeHTML) { @@ -263,7 +263,12 @@ export class Language extends Thing { } if (typeof arg !== 'string') { - return arg.toString(); + // TODO: Preserving type will be the only behavior. + if (preserveType) { + return arg; + } else { + return arg.toString(); + } } return escapeHTML(arg); |