From 0a28865518c62b7727651782505529de904c1d58 Mon Sep 17 00:00:00 2001 From: zwitschi Date: Wed, 5 Aug 2026 20:44:22 +0200 Subject: [PATCH] fix: allow el() to omit attributes when first child is a node or array --- app/static/app.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/static/app.js b/app/static/app.js index a1d5aa8..64c4bcd 100644 --- a/app/static/app.js +++ b/app/static/app.js @@ -59,6 +59,12 @@ function badge(state) { function el(tag, attrs = {}, ...children) { const node = document.createElement(tag); + // Allow el("tr", child1, child2, ...): if the 2nd argument is a node or an + // array, treat it as the first child instead of an attributes object. + if (attrs && (attrs.nodeType === 1 || Array.isArray(attrs))) { + children.unshift(attrs); + attrs = {}; + } for (const [k, v] of Object.entries(attrs || {})) { if (k === "class") node.className = v; else if (k === "text") node.textContent = v;