@@ -127,6 +127,7 @@ const wrapHandler = function(handler, eventName, options=null, context=null) {
127
127
}
128
128
}
129
129
130
+ // eslint-disable-next-line import/prefer-default-export
130
131
export class DomConnection {
131
132
constructor ( options ) {
132
133
// Limit search for elements to a
@@ -168,11 +169,8 @@ export class DomConnection {
168
169
// If the event is constrainted to a certain element
169
170
// or a set of elements, search for these within the
170
171
// specified element, and add the handler to each
171
- for ( const child of Array . from ( this . el . querySelectorAll ( selector ) ) ) {
172
- child . addEventListener (
173
- eventName , handler ,
174
- )
175
- }
172
+ Array . from ( this . el . querySelectorAll ( selector ) )
173
+ . forEach ( child => child . addEventListener ( eventName , handler ) )
176
174
} else {
177
175
// If no selector is supplied, the listener is
178
176
// added to the document itself
@@ -198,11 +196,8 @@ export class DomConnection {
198
196
199
197
if ( selector !== '' ) {
200
198
// Remove listener from specified elements
201
- for ( const child of Array . from ( this . el . querySelectorAll ( selector ) ) ) {
202
- child . removeEventListener (
203
- eventName , handler ,
204
- )
205
- }
199
+ Array . from ( this . el . querySelectorAll ( selector ) )
200
+ . forEach ( child => child . removeEventListener ( eventName , handler ) )
206
201
} else {
207
202
// Remove global listeners
208
203
document . removeEventListener (
0 commit comments