fix(devtools): check if node.children is undefined before trying to convert it into an array (ex. node is a text node)

This commit is contained in:
AleksanderBodurri 2020-03-05 11:13:01 -05:00 committed by Minko Gechev
parent a30d2a5653
commit 87aaa4933c

View file

@ -172,7 +172,7 @@ export class ComponentTreeObserver {
if (component) {
componentAccumulator.push(component);
} else {
Array.from(node.children).forEach(child =>
Array.from(node.children || []).forEach(child =>
this._getAllNestedComponentsWithinDomNode(child, componentAccumulator)
);
}
@ -186,9 +186,10 @@ export class ComponentTreeObserver {
directives = ng.getDirectives(node);
} catch {}
Array.from(node.children).forEach(
Array.from(node.children || []).forEach(
child => (directives = directives.concat(this._getAllNestedDirectivesWithinDomNode(child)))
);
return directives;
}