From 8d488f44ff87d218ff6045e528b7c947cfa1680b7c8e242457b8cf50a181d2b6 Mon Sep 17 00:00:00 2001 From: jhkaktus Date: Sun, 11 Oct 2026 00:43:21 +0200 Subject: [PATCH] fix: edit and delete buttons now actually fire their handlers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shared el() helper passed every attr through setAttribute(); for event handlers like onclick a function value gets stringified into an attribute the DOM compiles as an expression that is evaluated but never called - so Bearbeiten/Löschen (wired through el()) were silent no-ops, while addEventListener-wired buttons (Neuer Datensatz, Sperren) worked. el() now assigns on*-function attrs as properties (node[k] = v), preserving the real handler. Verified with a DOM-semantics shim: fixed path fires, legacy setAttribute path provably compiles but never calls. 🤖 Generated with Codebuff Co-Authored-By: Codebuff --- backend/static/ui.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/static/ui.js b/backend/static/ui.js index fd03872..2e4471e 100644 --- a/backend/static/ui.js +++ b/backend/static/ui.js @@ -37,6 +37,12 @@ function el(tag, attrs = {}, children = []) { for (const [k, v] of Object.entries(attrs)) { if (k === "class") node.className = v; else if (k === "text") node.textContent = v; + else if (k.startsWith("on") && typeof v === "function") { + // Event handlers MUST be assigned as properties: setAttribute(k, fn) + // stringifies the function ("... => ...") and never binds a listener, + // which silently killed the Bearbeiten/Löschen buttons. + node[k] = v; + } else node.setAttribute(k, v); } for (const child of children) node.appendChild(child);