@@ -113,7 +113,7 @@ export function initMutationObserver(
113
113
// If this callback returns `false`, we do not want to process the mutations
114
114
// This can be used to e.g. do a manual full snapshot when mutations become too large, or similar.
115
115
if ( options . onMutation && options . onMutation ( mutations ) === false ) {
116
- return ;
116
+ return ;
117
117
}
118
118
mutationBuffer . processMutations ( mutations ) ;
119
119
} ) ,
@@ -231,7 +231,9 @@ function initMouseInteractionObserver({
231
231
const getHandler = ( eventKey : keyof typeof MouseInteractions ) => {
232
232
return ( event : MouseEvent | TouchEvent ) => {
233
233
const target = getEventTarget ( event ) as Node ;
234
- if ( isBlocked ( target as Node , blockClass , blockSelector , unblockSelector ) ) {
234
+ if (
235
+ isBlocked ( target as Node , blockClass , blockSelector , unblockSelector )
236
+ ) {
235
237
return ;
236
238
}
237
239
const e = isTouchEvent ( event ) ? event . changedTouches [ 0 ] : event ;
@@ -275,11 +277,20 @@ export function initScrollObserver({
275
277
sampling,
276
278
} : Pick <
277
279
observerParam ,
278
- 'scrollCb' | 'doc' | 'mirror' | 'blockClass' | 'blockSelector' | 'unblockSelector' | 'sampling'
280
+ | 'scrollCb'
281
+ | 'doc'
282
+ | 'mirror'
283
+ | 'blockClass'
284
+ | 'blockSelector'
285
+ | 'unblockSelector'
286
+ | 'sampling'
279
287
> ) : listenerHandler {
280
288
const updatePosition = throttle < UIEvent > ( ( evt ) => {
281
289
const target = getEventTarget ( evt ) ;
282
- if ( ! target || isBlocked ( target as Node , blockClass , blockSelector , unblockSelector ) ) {
290
+ if (
291
+ ! target ||
292
+ isBlocked ( target as Node , blockClass , blockSelector , unblockSelector )
293
+ ) {
283
294
return ;
284
295
}
285
296
const id = mirror . getId ( target as INode ) ;
@@ -350,17 +361,18 @@ function initInputObserver({
350
361
} : observerParam ) : listenerHandler {
351
362
function eventHandler ( event : Event ) {
352
363
let target = getEventTarget ( event ) ;
364
+ const tagName = target && ( target as Element ) . tagName ;
365
+
353
366
const userTriggered = event . isTrusted ;
354
367
/**
355
368
* If a site changes the value 'selected' of an option element, the value of its parent element, usually a select element, will be changed as well.
356
369
* We can treat this change as a value change of the select element the current target belongs to.
357
370
*/
358
- if ( target && ( target as Element ) . tagName === 'OPTION' )
359
- target = ( target as Element ) . parentElement ;
371
+ if ( tagName === 'OPTION' ) target = ( target as Element ) . parentElement ;
360
372
if (
361
373
! target ||
362
- ! ( target as Element ) . tagName ||
363
- INPUT_TAGS . indexOf ( ( target as Element ) . tagName ) < 0 ||
374
+ ! tagName ||
375
+ INPUT_TAGS . indexOf ( tagName ) < 0 ||
364
376
isBlocked ( target as Node , blockClass , blockSelector , unblockSelector )
365
377
) {
366
378
return ;
@@ -386,7 +398,7 @@ function initInputObserver({
386
398
hasInputMaskOptions ( {
387
399
maskInputOptions,
388
400
maskInputSelector,
389
- tagName : ( target as HTMLElement ) . tagName ,
401
+ tagName,
390
402
type,
391
403
} )
392
404
) {
@@ -395,7 +407,7 @@ function initInputObserver({
395
407
maskInputOptions,
396
408
maskInputSelector,
397
409
unmaskInputSelector,
398
- tagName : ( target as HTMLElement ) . tagName ,
410
+ tagName,
399
411
type,
400
412
value : text ,
401
413
maskInputFn,
@@ -754,7 +766,10 @@ function initMediaInteractionObserver({
754
766
throttle (
755
767
callbackWrapper ( ( event : Event ) => {
756
768
const target = getEventTarget ( event ) ;
757
- if ( ! target || isBlocked ( target as Node , blockClass , blockSelector , unblockSelector ) ) {
769
+ if (
770
+ ! target ||
771
+ isBlocked ( target as Node , blockClass , blockSelector , unblockSelector )
772
+ ) {
758
773
return ;
759
774
}
760
775
const { currentTime, volume, muted } = target as HTMLMediaElement ;
0 commit comments