diff --git a/tp-form.js b/tp-form.js index 5adf09f..e5c67f1 100644 --- a/tp-form.js +++ b/tp-form.js @@ -324,8 +324,8 @@ class TpForm extends LitElement { reset() { for (let i = 0, li = this._origValues.length; i < li; ++i) { const item = this._origValues[i]; - item.control.value = this._copyValue(item.value || null, item.control); - item.control.checked = this._copyValue(item.checked || null, item.control); + item.control.value = this._copyValue(item.value ?? null, item.control); + item.control.checked = this._copyValue(item.checked ?? null, item.control); if (typeof item.control.reset === 'function') { item.control.reset(); } @@ -445,7 +445,7 @@ class TpForm extends LitElement { _copyValue(value, control) { if (control.defaultValue !== undefined || control.hasAttribute('default-value')) { - value = control.defaultValue || control.getAttribute('default-value'); + value = control.defaultValue ?? control.getAttribute('default-value'); } return clone(value);