« 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.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/util/html.js b/src/util/html.js
index 8cb411b3..b4c29b88 100644
--- a/src/util/html.js
+++ b/src/util/html.js
@@ -155,13 +155,21 @@ export function blank() {
 }
 
 export function tag(tagName, ...args) {
+  const lastArg = args.at(-1);
+
+  const lastArgIsAttributes =
+    typeof lastArg === 'object' && lastArg !== null &&
+    !Array.isArray(lastArg) &&
+    !(lastArg instanceof Tag) &&
+    !(lastArg instanceof Template);
+
   const content =
-    (isAttributes(args.at(-1))
+    (lastArgIsAttributes
       ? null
       : args.at(-1));
 
   const attributes =
-    (isAttributes(args.at(-1))
+    (lastArgIsAttributes
       ? args
       : args.slice(0, -1));