Skip to content
Snippets Groups Projects
Verified Commit e9fc8b94 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: update deadman switch assignment

parent d1192887
No related branches found
No related tags found
No related merge requests found
......@@ -74,11 +74,11 @@ class Form extends DataSet {
},
writeBack: {
events: ["change", "input", "keyup"],
events: ["keyup", "click", "change", "drop", "touchend", "input"]
},
bind: {
events: ["keyup", "click", "change", "drop", "touchend", "input"],
events: ["keyup", "click", "change", "drop", "touchend", "input"]
},
reportValidity: {
......@@ -170,23 +170,41 @@ function initEventHandler() {
this.addEventListener(event, (e) => {
const element = findTargetElementFromEvent(e, ATTRIBUTE_FORM_BIND);
if (element === undefined) {
if (!(element instanceof HTMLElement)) {
return;
}
if (this[debounceBindSymbol][element] instanceof DeadMansSwitch) {
let elementID = element.id;
if (id === "") {
elementID = element.getAttribute("name");
}
if (id === "") {
elementID = element.getAttribute("data-monster-attributes");
}
if (id === "") {
elementID = element.innerText.substring(0, 20);
}
elementID = elementID.replace(/\s/g, "_")
if (this[debounceBindSymbol][elementID] instanceof DeadMansSwitch) {
try {
this[debounceBindSymbol][element].touch();
this[debounceBindSymbol][elementID].touch();
return;
} catch (e) {
if (e.message !== "has already run") {
throw e;
}
delete this[debounceBindSymbol][element];
delete this[debounceBindSymbol][elementID];
}
}
this[debounceBindSymbol][element] = new DeadMansSwitch(200, () => {
this[debounceBindSymbol][elementID] = new DeadMansSwitch(200, () => {
delete this[debounceBindSymbol][elementID];
retrieveAndSetValue.call(this, element);
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment