Skip to content

armgit / kanzo

Public Imported from GitHub
0

Self-hosted, sharable kanban for humans and agents. One 4.7 MB binary, 5 MB of RAM, 10 to 60 tokens per agent reply, starts in 3 ms, zero setup.

Polyfill two DOM methods for older browsers

emanuele-em85ae3905c879
diff --git a/src/app.js b/src/app.js
index 9930b1e..39b9ec6 100644
--- a/src/app.js
+++ b/src/app.js
@@ -1,6 +1,20 @@
// The Kanzo board. Plain JavaScript, no build step; served at /app.js.
"use strict";
+// The board runs on browsers back to Safari 13.1, Chrome 80 and Firefox 78. These
+// two are newer than that, and are all it needs on top.
+if (!Element.prototype.replaceChildren) {
+ Element.prototype.replaceChildren = function (...nodes) {
+ this.textContent = "";
+ this.append(...nodes);
+ };
+}
+if (!HTMLFormElement.prototype.requestSubmit) {
+ HTMLFormElement.prototype.requestSubmit = function () {
+ if (this.reportValidity()) this.dispatchEvent(new Event("submit", { cancelable: true }));
+ };
+}
+
const $ = (sel, root = document) => root.querySelector(sel);
const STATUS_COLORS = ["#8a8a83", "#3b82f6", "#e8a317", "#2f9e44", "#ae3ec9", "#e8590c"];