summaryrefslogtreecommitdiff
path: root/ka.js
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2024-08-21 02:18:14 +0300
committerMarin Ivanov <[email protected]>2024-08-21 02:18:14 +0300
commit4b32d0bab72927da861d072991fd57f68a32b48f (patch)
tree6c5380f30f76e7d1dd428376fe9bc469f8e58d73 /ka.js
parentc550c3bc1c6cce7bb8a4916348e91dfb71074919 (diff)
js minification optimisation
Diffstat (limited to 'ka.js')
-rw-r--r--ka.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/ka.js b/ka.js
index 5dba500..95634cc 100644
--- a/ka.js
+++ b/ka.js
@@ -34,9 +34,9 @@ let {entries,fromEntries} = Object;
return this;
}
tag = (name, attrs, ...children) => {
- const el = doc.createElement(name);
+ let el = doc.createElement(name);
attrs && el.$attrs(attrs);
- for (const child of children.filter(x=>x)) {
+ for (let child of children.filter(x=>x)) {
el.appendChild((typeof(child) === 'string') ? doc.createTextNode(child) : child);
}
return el;
@@ -45,14 +45,14 @@ let {entries,fromEntries} = Object;
labelfor = (for_, ...children) => tag("label", {"for":for_}, ...children);
img = (src) => tag("img", {src});
input = (type) => tag("input", {type});
- const TRIVIAL = "main,section,nav,h1,h2,h3,p,b,div,span,form,select,button,table,tr,td";
+ let TRIVIAL = "main,section,nav,h1,h2,h3,p,b,div,span,form,select,button,table,tr,td";
for (let name of TRIVIAL.split(",")) {
window[name] = (...children) => tag(name, null, ...children);
}
mount = (root, app) => {
function reload() {
- const h = doc.location.hash || "#";
+ let h = doc.location.hash || "#";
root.replaceChildren(...app(h));
};
reload();