22 INode ,
33 hasInputMaskOptions ,
44 maskInputValue ,
5+ getInputType ,
6+ getInputValue ,
57} from '@sentry-internal/rrweb-snapshot' ;
68import { FontFaceSet } from 'css-font-loading-module' ;
79import {
@@ -361,7 +363,8 @@ function initInputObserver({
361363} : observerParam ) : listenerHandler {
362364 function eventHandler ( event : Event ) {
363365 let target = getEventTarget ( event ) ;
364- const tagName = target && ( target as Element ) . tagName ;
366+ const tagName =
367+ target && ( ( ( target as Element ) . tagName as unknown ) as Uppercase < string > ) ;
365368
366369 const userTriggered = event . isTrusted ;
367370 /**
@@ -377,24 +380,25 @@ function initInputObserver({
377380 ) {
378381 return ;
379382 }
380- let type : string | undefined = ( target as HTMLInputElement ) . type ;
383+ const el = target as
384+ | HTMLInputElement
385+ | HTMLSelectElement
386+ | HTMLTextAreaElement ;
387+ const type = getInputType ( el ) ;
381388 if (
382- ( target as HTMLElement ) . classList . contains ( ignoreClass ) ||
383- ( ignoreSelector && ( target as HTMLElement ) . matches ( ignoreSelector ) )
389+ el . classList . contains ( ignoreClass ) ||
390+ ( ignoreSelector && el . matches ( ignoreSelector ) )
384391 ) {
385392 return ;
386393 }
387394
388- let text = ( target as HTMLInputElement ) . value ;
395+ let text = getInputValue ( el , tagName , type ) ;
389396 let isChecked = false ;
390397
391- if ( ( target as HTMLElement ) . hasAttribute ( 'rr_is_password' ) ) {
392- type = 'password' ;
393- }
394-
395398 if ( type === 'radio' || type === 'checkbox' ) {
396399 isChecked = ( target as HTMLInputElement ) . checked ;
397- } else if (
400+ }
401+ if (
398402 hasInputMaskOptions ( {
399403 maskInputOptions,
400404 maskInputSelector,
@@ -403,7 +407,7 @@ function initInputObserver({
403407 } )
404408 ) {
405409 text = maskInputValue ( {
406- input : target as HTMLElement ,
410+ input : el ,
407411 maskInputOptions,
408412 maskInputSelector,
409413 unmaskInputSelector,
@@ -428,11 +432,21 @@ function initInputObserver({
428432 . querySelectorAll ( `input[type="radio"][name="${ name } "]` )
429433 . forEach ( ( el ) => {
430434 if ( el !== target ) {
435+ const text = maskInputValue ( {
436+ input : el as HTMLInputElement ,
437+ maskInputOptions,
438+ maskInputSelector,
439+ unmaskInputSelector,
440+ tagName,
441+ type,
442+ value : getInputValue ( el as HTMLInputElement , tagName , type ) ,
443+ maskInputFn,
444+ } ) ;
431445 cbWithDedup (
432446 el ,
433447 callbackWrapper ( wrapEventWithUserTriggeredFlag ) (
434448 {
435- text : ( el as HTMLInputElement ) . value ,
449+ text,
436450 isChecked : ! isChecked ,
437451 userTriggered : false ,
438452 } ,
0 commit comments