[FIX] can use t-out with String classes

This commit is contained in:
Bruno Boi
2022-02-08 12:49:10 +01:00
committed by Aaron Bohy
parent 3196b585fd
commit cc8e11c9c9
4 changed files with 54 additions and 4 deletions
+1 -1
View File
@@ -135,7 +135,7 @@ export function safeOutput(value: any): ReturnType<typeof toggler> {
} else if (value instanceof LazyValue) {
safeKey = `lazy_value`;
block = value.evaluate();
} else if (typeof value === "string") {
} else if (value instanceof String || typeof value === "string") {
safeKey = "string_unsafe";
block = text(value);
} else {
+3 -3
View File
@@ -9,11 +9,11 @@ const characterDataSetData = getDescriptor(characterDataProto, "data").set!;
const nodeRemoveChild = nodeProto.removeChild;
abstract class VSimpleNode {
text: string;
text: string | String;
parentEl?: HTMLElement | undefined;
el?: any;
constructor(text: string) {
constructor(text: string | String) {
this.text = text;
}
@@ -65,7 +65,7 @@ class VComment extends VSimpleNode {
patch() {}
}
export function text(str: string): VNode<VText> {
export function text(str: string | String): VNode<VText> {
return new VText(str);
}