« get me outta code hell

html: allow adding an Attributes object - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-12-30 09:50:30 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-12-30 16:26:35 -0400
commit25c434a514152fdd02e5405e4de418cd62614c6a (patch)
tree639f4703d762542905b0aa4525c015899bd4a9b8
parent973a229843ef16f5056c69fc84d89ef5e0a6b49c (diff)
html: allow adding an Attributes object
-rw-r--r--src/util/html.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/util/html.js b/src/util/html.js
index dd6c3b05..ecc2b065 100644
--- a/src/util/html.js
+++ b/src/util/html.js
@@ -673,6 +673,10 @@ export class Attributes {
       return attributes.map(item => this.#addMultipleAttributes(item));
     }
 
+    if (attributes instanceof Attributes) {
+      return this.#addMultipleAttributes(attributes.attributes);
+    }
+
     if (attributes instanceof Template) {
       const resolved = Template.resolve(attributes);
       isAttributesAdditionSingletValue(resolved);
@@ -1379,6 +1383,7 @@ export const isAttributesAdditionPair = pair => {
 export const isAttributesAdditionSingletValue =
   oneOf(
     validateInstanceOf(Template),
+    validateInstanceOf(Attributes),
     validateAllPropertyValues(isAttributeValue),
     looseArrayOf(value => isAttributesAdditionSingletValue(value)));