File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -80,10 +80,10 @@ let canvasCtx: CanvasRenderingContext2D | null;
8080
8181function initCanvasService ( doc : Document ) {
8282 if ( ! canvasService ) {
83- canvasService = doc . createElement ( 'canvas' ) ;
83+ canvasService = doc . createElement ( 'canvas' ) ;
8484 }
8585 if ( ! canvasCtx ) {
86- canvasCtx = canvasService . getContext ( '2d' ) ;
86+ canvasCtx = canvasService . getContext ( '2d' ) ;
8787 }
8888 canvasService . width = 0 ;
8989 canvasService . height = 0 ;
@@ -502,7 +502,7 @@ function serializeNode(
502502 }
503503 }
504504 if ( tagName === 'option' ) {
505- if ( ( n as HTMLOptionElement ) . selected ) {
505+ if ( ( n as HTMLOptionElement ) . selected && ! maskInputOptions [ 'select' ] ) {
506506 attributes . selected = true ;
507507 } else {
508508 // ignore the html attribute (which corresponds to DOM (n as HTMLOptionElement).defaultSelected)
@@ -516,7 +516,7 @@ function serializeNode(
516516 }
517517 // save image offline
518518 if ( tagName === 'img' && inlineImages && canvasService && canvasCtx ) {
519- const image = ( n as HTMLImageElement ) ;
519+ const image = n as HTMLImageElement ;
520520 image . crossOrigin = 'anonymous' ;
521521 try {
522522 canvasService . width = image . naturalWidth ;
Original file line number Diff line number Diff line change @@ -369,8 +369,10 @@ function initInputObserver(
369369 userTriggeredOnInput : boolean ,
370370) : listenerHandler {
371371 function eventHandler ( event : Event ) {
372- const target = getEventTarget ( event ) ;
372+ let target = getEventTarget ( event ) ;
373373 const userTriggered = event . isTrusted ;
374+ if ( target && ( target as Element ) . tagName === 'OPTION' )
375+ target = ( target as Element ) . parentElement ;
374376 if (
375377 ! target ||
376378 ! ( target as Element ) . tagName ||
@@ -461,6 +463,7 @@ function initInputObserver(
461463 [ HTMLTextAreaElement . prototype , 'value' ] ,
462464 // Some UI library use selectedIndex to set select value
463465 [ HTMLSelectElement . prototype , 'selectedIndex' ] ,
466+ [ HTMLOptionElement . prototype , 'selected' ] ,
464467 ] ;
465468 if ( propertyDescriptor && propertyDescriptor . set ) {
466469 handlers . push (
Original file line number Diff line number Diff line change @@ -6066,8 +6066,7 @@ exports[`record integration tests should not record input values if maskAllInput
60666066 \\" type\\ " : 2 ,
60676067 \\" tagName\\ " : \\" option\\ " ,
60686068 \\" attributes\\ " : {
6069- \\" value\\ " : \\" 1\\ " ,
6070- \\" selected\\ " : true
6069+ \\" value\\ " : \\" 1\\ "
60716070 },
60726071 \\" childNodes\\ " : [
60736072 {
You can’t perform that action at this time.
0 commit comments