From 000455c98fba84d891589f3e1ea2243f78a50012 Mon Sep 17 00:00:00 2001 From: re-fort Date: Tue, 11 Apr 2023 14:22:37 +0900 Subject: [PATCH 1/4] fix: change default value of input type from null to text --- packages/rrweb-snapshot/src/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/rrweb-snapshot/src/utils.ts b/packages/rrweb-snapshot/src/utils.ts index a443cb96c1..2ab2320509 100644 --- a/packages/rrweb-snapshot/src/utils.ts +++ b/packages/rrweb-snapshot/src/utils.ts @@ -263,5 +263,6 @@ export function getInputType(element: HTMLElement): Lowercase | null { : type ? // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion (type.toLowerCase() as Lowercase) - : null; + // the missing value default is the text + : 'text'; } From 7f8729a70d932af989e5c7626e01969b41153349 Mon Sep 17 00:00:00 2001 From: re-fort Date: Tue, 11 Apr 2023 05:25:11 +0000 Subject: [PATCH 2/4] Apply formatting changes --- packages/rrweb-snapshot/src/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/rrweb-snapshot/src/utils.ts b/packages/rrweb-snapshot/src/utils.ts index 2ab2320509..2e9f3ea9f2 100644 --- a/packages/rrweb-snapshot/src/utils.ts +++ b/packages/rrweb-snapshot/src/utils.ts @@ -263,6 +263,6 @@ export function getInputType(element: HTMLElement): Lowercase | null { : type ? // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion (type.toLowerCase() as Lowercase) - // the missing value default is the text - : 'text'; + : // the missing value default is the text + 'text'; } From 5b12cd4faa6b38bc3ed167dac52549693b319510 Mon Sep 17 00:00:00 2001 From: re-fort Date: Tue, 11 Apr 2023 14:50:38 +0900 Subject: [PATCH 3/4] add changeset --- .changeset/ten-walls-scream.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/ten-walls-scream.md diff --git a/.changeset/ten-walls-scream.md b/.changeset/ten-walls-scream.md new file mode 100644 index 0000000000..5bc9111d06 --- /dev/null +++ b/.changeset/ten-walls-scream.md @@ -0,0 +1,5 @@ +--- +'rrweb-snapshot': patch +--- + +change default value of input type from null to text From b1fd478e6925523e2894ea09a7bbd69c40dd369c Mon Sep 17 00:00:00 2001 From: re-fort Date: Thu, 13 Apr 2023 16:33:55 +0900 Subject: [PATCH 4/4] add a comment related to the type of input element --- .changeset/ten-walls-scream.md | 5 ----- packages/rrweb-snapshot/src/utils.ts | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 .changeset/ten-walls-scream.md diff --git a/.changeset/ten-walls-scream.md b/.changeset/ten-walls-scream.md deleted file mode 100644 index 5bc9111d06..0000000000 --- a/.changeset/ten-walls-scream.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'rrweb-snapshot': patch ---- - -change default value of input type from null to text diff --git a/packages/rrweb-snapshot/src/utils.ts b/packages/rrweb-snapshot/src/utils.ts index 2e9f3ea9f2..110cf1a735 100644 --- a/packages/rrweb-snapshot/src/utils.ts +++ b/packages/rrweb-snapshot/src/utils.ts @@ -256,6 +256,7 @@ export function isNodeMetaEqual(a: serializedNode, b: serializedNode): boolean { * where passwords should be masked. */ export function getInputType(element: HTMLElement): Lowercase | null { + // when omitting the type of input element(e.g. ), the type is treated as text const type = (element as HTMLInputElement).type; return element.hasAttribute('data-rr-is-password') @@ -263,6 +264,5 @@ export function getInputType(element: HTMLElement): Lowercase | null { : type ? // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion (type.toLowerCase() as Lowercase) - : // the missing value default is the text - 'text'; + : null; }