From 7352ab2bafcb11b4254bdb6ec0efad308012abaf Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Tue, 21 Feb 2023 22:10:25 +0800 Subject: [PATCH 1/2] #729@patch: Convert input value to string. --- .../happy-dom/src/nodes/html-input-element/HTMLInputElement.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts b/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts index c21c80bc6..33b83e612 100644 --- a/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts +++ b/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts @@ -596,6 +596,8 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE * @param value Value. */ public set value(value: string) { + // the value maybe not string, so we need to convert it to string + value = String(value); switch (this.type) { case 'hidden': case 'submit': From 99a785d450401113c6340ae16382a86607d168d2 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Tue, 21 Feb 2023 22:11:58 +0800 Subject: [PATCH 2/2] #729@patch: Format. --- .../happy-dom/src/nodes/html-input-element/HTMLInputElement.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts b/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts index 33b83e612..6de805e3b 100644 --- a/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts +++ b/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts @@ -596,7 +596,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE * @param value Value. */ public set value(value: string) { - // the value maybe not string, so we need to convert it to string + // The value maybe not string, so we need to convert it to string value = String(value); switch (this.type) { case 'hidden':