summaryrefslogtreecommitdiff
path: root/ka.js
diff options
context:
space:
mode:
Diffstat (limited to 'ka.js')
-rw-r--r--ka.js18
1 files changed, 7 insertions, 11 deletions
diff --git a/ka.js b/ka.js
index d2ae4bc..5dba500 100644
--- a/ka.js
+++ b/ka.js
@@ -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;
}