« get me outta code hell

html: pass null/undefined through in slot values - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-03-29 09:41:19 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-03-29 09:41:19 -0300
commit47a2d6a9adf5059c194350e61d6beb3ff083088c (patch)
treef3e8fee6b62b5be0bdd525bc10c0bb5d74742ece /src
parent589dfa71fd73661e990d0d7ef70bd700b2e58165 (diff)
html: pass null/undefined through in slot values
Diffstat (limited to 'src')
-rw-r--r--src/util/html.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util/html.js b/src/util/html.js
index 3980b9aa..5ea5e0ad 100644
--- a/src/util/html.js
+++ b/src/util/html.js
@@ -398,7 +398,11 @@ export class Template {
 
   getSlot(slotName) {
     if (this.#slotContents[slotName]) {
-      const contents = this.#slotContents[slotName].map(item => item.valueOf());
+      const contents = this.#slotContents[slotName]
+        .map(item =>
+          (item === null || item === undefined
+            ? item
+            : item.valueOf()));
       return new Tag(null, null, contents).valueOf();
     } else {
       return [];