From ec1ab18897d8dcd20d13fa5b5e1096b80a21ce95 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 29 Dec 2023 16:01:21 -0400 Subject: data: language: support multiple children in #wrapSanitized --- src/data/things/language.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/data/things/language.js') diff --git a/src/data/things/language.js b/src/data/things/language.js index 60d089b7..4481af55 100644 --- a/src/data/things/language.js +++ b/src/data/things/language.js @@ -1,8 +1,8 @@ import { Temporal, toTemporalInstant } from '@js-temporal/polyfill'; -import {isLanguageCode} from '#validators'; -import {Tag} from '#html'; +import * as html from '#html'; import {empty, withAggregate} from '#sugar'; +import {isLanguageCode} from '#validators'; import { getExternalLinkStringOfStyleFromDescriptors, @@ -274,8 +274,11 @@ export class Language extends Thing { // content is a string *that may contain HTML* and doesn't need to // sanitized any further. It'll still .toString() to just the string // contents, if needed. - #wrapSanitized(output) { - return new Tag(null, null, output); + #wrapSanitized(content) { + return html.tags(content, { + [html.joinChildren]: '', + [html.noEdgeWhitespace]: true, + }); } // Similar to the above internal methods, but this one is public. @@ -296,7 +299,7 @@ export class Language extends Thing { return ( (typeof arg === 'string' - ? new Tag(null, null, escapeHTML(arg)) + ? this.#wrapSanitized(escapeHTML(arg)) : arg)); } -- cgit 1.3.0-6-gf8a5