Skip to content

Commit

Permalink
fix form handling
Browse files Browse the repository at this point in the history
  • Loading branch information
binarykitchen committed Nov 3, 2024
1 parent 639bda6 commit 3c2f317
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/wrappers/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ class Container extends Despot {
}

private getFormElement() {
// It's ok to return no form, especially when in replay mode
let formElement: HTMLFormElement | undefined | null;

if (this.containerElement && this.containerElement.tagName === "FORM") {
Expand All @@ -165,7 +166,7 @@ class Container extends Despot {
`#${this.options.selectors.formId}`,
);

if (!formElement || formElement.tagName !== "FORM") {
if (formElement && formElement.tagName !== "FORM") {
throw new Error(
`HTML element with ID ${this.options.selectors.formId} is not a form.`,
);
Expand Down

0 comments on commit 3c2f317

Please sign in to comment.