Skip to content

Commit

Permalink
fix: textarea duplicate values
Browse files Browse the repository at this point in the history
+ add tests
  • Loading branch information
billyvg committed Feb 23, 2023
1 parent 1cb2ec9 commit f7fec59
Show file tree
Hide file tree
Showing 5 changed files with 1,644 additions and 47 deletions.
5 changes: 2 additions & 3 deletions packages/rrweb-snapshot/src/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,9 @@ function serializeNode(
// form fields
if (
tagName === 'input' ||
tagName === 'textarea' ||
tagName === 'select'
) {
const value = (n as HTMLInputElement | HTMLTextAreaElement).value;
const value = (n as HTMLInputElement).value;
if (
attributes.type !== 'radio' &&
attributes.type !== 'checkbox' &&
Expand Down Expand Up @@ -1249,4 +1248,4 @@ export default snapshot;
/** We want to skip `autoplay` attribute, as this has weird results when replaying. */
function skipAttribute(tagName: string, attributeName: string, value?: unknown) {
return (tagName === 'video' || tagName === 'audio') && attributeName === 'autoplay';
}
}
1 change: 1 addition & 0 deletions packages/rrweb-snapshot/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export function maskInputValue({
if (
maskInputOptions[tagName.toLowerCase() as keyof MaskInputOptions] ||
maskInputOptions[type as keyof MaskInputOptions] ||
(tagName === 'input' && !type && maskInputOptions['text']) || // For inputs without a "type" attribute defined
(maskInputSelector && input.matches(maskInputSelector))
) {
if (maskInputFn) {
Expand Down
Loading

0 comments on commit f7fec59

Please sign in to comment.