From 3c2f317eb9fab8fb6f98e18e70c9f20550ff0459 Mon Sep 17 00:00:00 2001 From: Michael Heuberger Date: Sun, 3 Nov 2024 15:28:22 +1300 Subject: [PATCH] fix form handling --- src/wrappers/container.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wrappers/container.ts b/src/wrappers/container.ts index 8f10e089..5102206f 100644 --- a/src/wrappers/container.ts +++ b/src/wrappers/container.ts @@ -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") { @@ -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.`, );