Skip to content

Commit

Permalink
Check that type of root is Element before using closest
Browse files Browse the repository at this point in the history
Co-authored-by: Keith Dahlby <[email protected]>
  • Loading branch information
LiteracyFanatic and dahlbyk authored Aug 1, 2023
1 parent 4bb44e9 commit d2b4570
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ export class ValidationService {
forms.push(root);
}
// If root is the descendant of a form, we want to include that form too.
const containingForm = (root as HTMLElement).closest('form');
const containingForm = (root instanceof Element) ? root.closest('form') : null;
if (containingForm) {
forms.push(containingForm);
}
Expand Down

0 comments on commit d2b4570

Please sign in to comment.