diff options
| author | Marin Ivanov <[email protected]> | 2024-08-21 00:15:59 +0300 |
|---|---|---|
| committer | Marin Ivanov <[email protected]> | 2024-08-21 00:39:15 +0300 |
| commit | 4010314ed257aeb09cfea9e24ed9e34731375245 (patch) | |
| tree | c6043bfdf5c159564355cb8efb1eb9be905eac38 /ka.js | |
| parent | 57bebd16ff7e89bfe5e9089ac4c0a21733675f22 (diff) | |
size optimisation
Diffstat (limited to 'ka.js')
| -rw-r--r-- | ka.js | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -1,8 +1,8 @@ -(()=>{ - doc = document; - entries = Object.entries; +doc = document; +let {entries,fromEntries} = Object; - var ep = Element.prototype; +(()=>{ + let ep = Element.prototype; ep.attr = function(name){ return this.getAttribute(name); }; @@ -25,15 +25,11 @@ this.onclick = callback; return this; } - const getvalue = x => x.value; - ep.$change2state = function(state, field, valgetter=getvalue) { + let getval = x => x.value; + ep.$change2state = function(state, field, getter=getval) { this.oninput = () => { this.setCustomValidity(''); - if (this.validity.valid) { - state[field] = valgetter(this); - } else { - this.reportValidity(); - } + this.validity.valid && (state[field] = getter(this)) || this.reportValidity(); }; return this; } |
