@@ -147,7 +147,7 @@ define([
147
147
*/
148
148
function processAdded ( node ) {
149
149
_ . each ( watchers . selectors , function ( listeners , selector ) {
150
- listeners . forEach ( function ( data ) {
150
+ for ( let data of listeners ) {
151
151
if ( ! data . ctx . contains ( node ) || ! $ ( node , data . ctx ) . is ( selector ) ) {
152
152
return ;
153
153
}
@@ -157,7 +157,7 @@ define([
157
157
} else if ( data . type === 'remove' ) {
158
158
addRemovalListener ( node , data ) ;
159
159
}
160
- } ) ;
160
+ }
161
161
} ) ;
162
162
}
163
163
@@ -170,14 +170,14 @@ define([
170
170
var nodeData = getNodeData ( node ) ,
171
171
listeners = nodeData && nodeData . remove ;
172
172
173
+
173
174
if ( ! listeners ) {
174
175
return ;
175
176
}
176
177
177
- listeners . forEach ( function ( data ) {
178
+ for ( let data of listeners ) {
178
179
trigger ( node , data ) ;
179
- } ) ;
180
-
180
+ }
181
181
removeNodeData ( node ) ;
182
182
}
183
183
@@ -194,12 +194,12 @@ define([
194
194
195
195
nodes = _ . toArray ( nodes ) . filter ( isElementNode ) ;
196
196
197
- nodes . forEach ( function ( node ) {
197
+ for ( let node of nodes ) {
198
198
result . push ( node ) ;
199
199
200
200
children = extractChildren ( node ) ;
201
- result = result . concat ( children ) ;
202
- } ) ;
201
+ result . push ( ... children ) ;
202
+ }
203
203
204
204
return result ;
205
205
}
@@ -216,10 +216,10 @@ define([
216
216
var removed = [ ] ,
217
217
added = [ ] ;
218
218
219
- mutations . forEach ( function ( record ) {
220
- removed = removed . concat ( _ . toArray ( record . removedNodes ) ) ;
221
- added = added . concat ( _ . toArray ( record . addedNodes ) ) ;
222
- } ) ;
219
+ for ( let record of mutations ) {
220
+ removed . push ( ... record . removedNodes ) ;
221
+ added . push ( ... record . addedNodes ) ;
222
+ }
223
223
224
224
removed = removed . filter ( function ( node ) {
225
225
var addIndex = added . indexOf ( node ) ,
@@ -285,10 +285,16 @@ define([
285
285
var changes ;
286
286
287
287
if ( shouldObserveMutations ( mutations ) ) {
288
+ let node ;
289
+
288
290
changes = formChangesLists ( mutations ) ;
289
291
290
- changes . removed . forEach ( processRemoved ) ;
291
- changes . added . forEach ( processAdded ) ;
292
+ for ( node of changes . removed ) {
293
+ processRemoved ( node ) ;
294
+ }
295
+ for ( node of changes . added ) {
296
+ processAdded ( node ) ;
297
+ }
292
298
}
293
299
} ) ;
294
300
@@ -331,10 +337,9 @@ define([
331
337
332
338
nodes = $ ( selector , data . ctx ) . toArray ( ) ;
333
339
334
- nodes . forEach ( function ( node ) {
340
+ for ( let node of nodes ) {
335
341
trigger ( node , data ) ;
336
- } ) ;
337
-
342
+ }
338
343
addSelectorListener ( selector , data ) ;
339
344
} ,
340
345
@@ -366,9 +371,9 @@ define([
366
371
addSelectorListener ( selector , data ) ;
367
372
}
368
373
369
- nodes . forEach ( function ( node ) {
374
+ for ( let node of nodes ) {
370
375
addRemovalListener ( node , data ) ;
371
- } ) ;
376
+ }
372
377
} ,
373
378
374
379
/**
0 commit comments