- let me = this,
- bottomUpFiltering = me.filterer === 'bottomup',
- match = filterFn(node) && parentVisible || (node.isRoot() && !me.getRootVisible()),
- childNodes = node.childNodes,
- len = childNodes && childNodes.length, i, matchingChildren;
-
- if (len) {
- for (i = 0; i < len; ++i) {
- matchingChildren = me.filterNodes(childNodes[i], filterFn, match || bottomUpFiltering) || matchingChildren;
+ let me = this;
+
+ let match = filterFn(node) && (parentVisible || (node.isRoot() && !me.getRootVisible()));
+
+ if (node.childNodes && node.childNodes.length) {
+ let bottomUpFiltering = me.filterer === 'bottomup';
+ let childMatch;
+ for (const child of node.childNodes) {
+ childMatch = me.filterNodes(child, filterFn, match || bottomUpFiltering) || childMatch;