* Match all the descendants of a DOM node against a predicate. * * @param nativeNode the current native node * @param predicate the predicate to match * @param matches the list where matches are stored * @param elementsOnly whether only elements should be searched
( parentNode: any, predicate: Predicate<DebugElement> | Predicate<DebugNode>, matches: DebugElement[] | DebugNode[], elementsOnly: boolean, )
| 648 | * @param elementsOnly whether only elements should be searched |
| 649 | */ |
| 650 | function _queryNativeNodeDescendants( |
| 651 | parentNode: any, |
| 652 | predicate: Predicate<DebugElement> | Predicate<DebugNode>, |
| 653 | matches: DebugElement[] | DebugNode[], |
| 654 | elementsOnly: boolean, |
| 655 | ) { |
| 656 | const nodes = parentNode.childNodes; |
| 657 | const length = nodes.length; |
| 658 | |
| 659 | for (let i = 0; i < length; i++) { |
| 660 | const node = nodes[i]; |
| 661 | const debugNode = getDebugNode(node); |
| 662 | |
| 663 | if (debugNode) { |
| 664 | if ( |
| 665 | elementsOnly && |
| 666 | debugNode instanceof DebugElement && |
| 667 | predicate(debugNode) && |
| 668 | matches.indexOf(debugNode) === -1 |
| 669 | ) { |
| 670 | matches.push(debugNode); |
| 671 | } else if ( |
| 672 | !elementsOnly && |
| 673 | (predicate as Predicate<DebugNode>)(debugNode) && |
| 674 | (matches as DebugNode[]).indexOf(debugNode) === -1 |
| 675 | ) { |
| 676 | (matches as DebugNode[]).push(debugNode); |
| 677 | } |
| 678 | |
| 679 | _queryNativeNodeDescendants(node, predicate, matches, elementsOnly); |
| 680 | } |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | /** |
| 685 | * Iterates through the property bindings for a given node and generates |
no test coverage detected
searching dependent graphs…