fix: Controlla se `reportValidity` esiste

This commit is contained in:
Maicol Battistini 2023-06-12 15:23:31 +02:00
parent 64342f8aaa
commit 8af4c44e3f
No known key found for this signature in database
1 changed files with 1 additions and 1 deletions

View File

@ -113,7 +113,7 @@ export async function showSnackbar(
export function isFormValid(form: HTMLFormElement): boolean {
let isValid = true;
for (const element of form.elements) {
if (!(element as HTMLInputElement).reportValidity()) {
if (typeof (element as HTMLInputElement).reportValidity === 'function' && !(element as HTMLInputElement).reportValidity()) {
isValid = false;
}
}