« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/html.js29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/util/html.js b/src/util/html.js
index f13f8c29..4be008ed 100644
--- a/src/util/html.js
+++ b/src/util/html.js
@@ -397,14 +397,27 @@ export class Tag {
     const joiner =
       (this.joinChildren === undefined
         ? '\n'
-        : (this.joinChildren === ''
-            ? ''
-            : `\n${this.joinChildren}\n`));
-
-    return this.content
-      .map(item => item.toString())
-      .filter(Boolean)
-      .join(joiner);
+     : this.joinChildren === ''
+        ? ''
+        : `\n${this.joinChildren}\n`);
+
+    let content = '';
+
+    for (const [index, item] of this.content.entries()) {
+      const itemContent = item.toString();
+
+      if (!itemContent) {
+        continue;
+      }
+
+      if (content) {
+        content += joiner;
+      }
+
+      content += itemContent;
+    }
+
+    return content;
   }
 
   static normalize(content) {