From 98c033a6a97b5a8fd2e2405495c7753ccd511d5d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 31 Dec 2023 21:57:44 -0400 Subject: html: inline html.tag()-specific isAttributes behavior --- src/util/html.js | 12 ++++++++++-- 1 file 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)); -- cgit 1.3.0-6-gf8a5