Use addCallbackAndRunD where applicable, which deletes many if(value==undefined) checks

This commit is contained in:
Pieter Vander Vennet 2021-06-30 15:38:14 +02:00
parent d7e421efc9
commit 6576ac36cc
5 changed files with 6 additions and 18 deletions

View file

@ -64,11 +64,8 @@ export class TextField extends InputElement<string> {
const field = inputEl;
this.value.addCallbackAndRun(value => {
if (value === undefined || value === null) {
// We leave the textfield as is - make sure we do not erase it!
return;
}
this.value.addCallbackAndRunD(value => {
// We leave the textfield as is in the case of undefined or null (handled by addCallbackAndRunD) - make sure we do not erase it!
field["value"] = value;
if (self.IsValid(value)) {
self.RemoveClass("invalid")