« get me outta code hell

html: inline html.tag()-specific isAttributes behavior - 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:
author(quasar) nebula <qznebula@protonmail.com>2023-12-31 21:57:44 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-01-01 15:19:32 -0400
commit98c033a6a97b5a8fd2e2405495c7753ccd511d5d (patch)
tree132900591fc82b7f166df918f25b1b511931c250 /src/util
parent9d513777ee4c8b0893079e96b02df54ee25cca30 (diff)
html: inline html.tag()-specific isAttributes behavior
Diffstat (limited to 'src/util')
-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));