@@ -34,10 +34,10 @@ export default function handleInput(
3434 }
3535
3636 const unbind : ( ( ) => void ) [ ] = [ ] ;
37- for ( const event of events ) {
38- parentToBind . addEventListener ( event , handler ) ;
37+ for ( const eventName of events ) {
38+ parentToBind . addEventListener ( eventName , handler ) ;
3939 unbind . push ( ( ) => {
40- parentToBind . removeEventListener ( event , handler ) ;
40+ parentToBind . removeEventListener ( eventName , handler ) ;
4141 } ) ;
4242 }
4343
@@ -48,28 +48,14 @@ export default function handleInput(
4848 const inputs = new Set < HTMLInputElement > ( ) ;
4949
5050 for ( const mutation of mutations ) {
51- for ( const node of mutation . addedNodes ) {
51+ for ( const node of [ ... mutation . addedNodes , ... mutation . removedNodes ] ) {
5252 if ( ! ( node instanceof HTMLElement ) ) continue ;
5353
5454 if ( detectElement ( node ) ) {
5555 inputs . add ( node as HTMLInputElement ) ;
5656 }
5757
58- [ ...findInputs ( node ) ] . forEach ( ( el ) => {
59- if ( detectElement ( el as HTMLElement ) ) {
60- inputs . add ( el as HTMLInputElement ) ;
61- }
62- } ) ;
63- }
64-
65- for ( const node of mutation . removedNodes ) {
66- if ( ! ( node instanceof HTMLElement ) ) continue ;
67-
68- if ( detectElement ( node ) ) {
69- inputs . add ( node as HTMLInputElement ) ;
70- }
71-
72- [ ...findInputs ( node ) ] . forEach ( ( el ) => {
58+ findInputs ( node ) . forEach ( ( el ) => {
7359 if ( detectElement ( el as HTMLElement ) ) {
7460 inputs . add ( el as HTMLInputElement ) ;
7561 }
0 commit comments