« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/util/html.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/util/html.js b/src/util/html.js
index b4c29b8..2e3204f 100644
--- a/src/util/html.js
+++ b/src/util/html.js
@@ -644,7 +644,11 @@ export class Attributes {
 
   set(attribute, value) {
     if (value instanceof Template) {
-      return this.set(attribute, Template.resolve(value));
+      value = Template.resolve(value);
+    }
+
+    if (Array.isArray(value)) {
+      value = value.flat(Infinity);
     }
 
     if (value === null || value === undefined) {
@@ -724,6 +728,10 @@ export class Attributes {
       return this.#addOneAttribute(attribute, Template.resolve(value));
     }
 
+    if (Array.isArray(value)) {
+      value = value.flat(Infinity);
+    }
+
     if (!this.has(attribute)) {
       return this.set(attribute, value);
     }