Skip to content

Commit

Permalink
use Uppercase type
Browse files Browse the repository at this point in the history
  • Loading branch information
mydea committed Mar 6, 2023
1 parent 4b89cee commit 023334b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/rrweb-snapshot/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export function maskInputValue({
maskInputFn,
}: {
maskInputOptions: MaskInputOptions;
tagName: 'SELECT' | 'INPUT' | 'TEXTAREA' | 'OPTION';
tagName: Uppercase<string>;
type: string | number | boolean | null;
value: string | null;
maskInputFn?: MaskInputFn;
Expand Down
5 changes: 3 additions & 2 deletions packages/rrweb/src/record/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,14 +483,15 @@ export default class MutationBuffer {
}
break;
}

case 'attributes': {
const target = m.target as HTMLElement;
let value = (m.target as HTMLElement).getAttribute(m.attributeName!);
if (m.attributeName === 'value') {
value = maskInputValue({
maskInputOptions: this.maskInputOptions,
tagName: (m.target as HTMLElement).tagName as 'SELECT' | 'INPUT' | 'TEXTAREA' | 'OPTION',
type: (m.target as HTMLElement).getAttribute('type'),
tagName: target.tagName as unknown as Uppercase<string>,
type: target.getAttribute('type'),
value,
maskInputFn: this.maskInputFn,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/record/observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ function initInputObserver({
) {
text = maskInputValue({
maskInputOptions,
tagName: (target as HTMLElement).tagName as 'SELECT' | 'INPUT' | 'TEXTAREA' | 'OPTION',
tagName: (target as HTMLElement).tagName as unknown as Uppercase<string>,
type,
value: text,
maskInputFn,
Expand Down

0 comments on commit 023334b

Please sign in to comment.