author | Alan Dipert
<alan@dipert.org> 2021-06-02 13:31:04 UTC |
committer | Alan Dipert
<alan@dipert.org> 2021-06-02 13:31:04 UTC |
parent | 6341c4fb5f7c3cdc7891f85dce67c9a02069ebb1 |
el.mjs | +4 | -9 |
diff --git a/el.mjs b/el.mjs index 91c2ce2..1979dfa 100644 --- a/el.mjs +++ b/el.mjs @@ -1,20 +1,15 @@ import { _ } from './datalog.mjs'; import { Input, Formula, input, database, view, watch } from './reactives.mjs'; -const on = new Proxy({}, { - get: (obj, name) => Symbol.for(name) -}); - function el(tag, attrs, kids) { let el = document.createElement(tag); - for (const k of Reflect.ownKeys(attrs)) { - let v = attrs[k]; + for (let [k, v] of Object.entries(attrs)) { if (v instanceof Input || v instanceof Formula) { watch((oldv, newv) => { el.setAttribute(k, newv); })(v); - } else if (typeof k === "symbol") { - el.addEventListener(k.description, v) + } else if (k.startsWith("on")) { + el.addEventListener(k.slice(2), v); } else { el.setAttribute(k, v); } @@ -181,7 +176,7 @@ function entities(db, makeNode) { // return parent; // } -export { $el, on, entities }; +export { $el, entities }; // function renderInto(parent, view, templateFunction) { // }