From 8923fc4086ed66fa888edc6165c65e50c6afd94a Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 29 Dec 2023 16:02:01 -0400 Subject: data: language: support preserving value type in #sanitizeStringArg Behind an option, for now. --- src/data/things/language.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/data/things') 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); -- cgit 1.3.0-6-gf8a5