createDomNodes function
Creates one or more DOM nodes from a resolved Morphic.
For FragmentMorphic, returns one node per child (recursively expanded). For all other Morphic types, returns a single-element list.
This is the correct entry point when iterating children that may include
fragments — both in createDom and in diff.dart's _createDomNodes.
Implementation
List<Node> createDomNodes(Morphic node, {Component? componentOwner}) {
if (node is FragmentMorphic) {
final nodes = <Node>[];
for (final child in node.children) {
Component? childOwner;
try {
childOwner = RenderContext.runtime.ownerOf(child);
} catch (_) {}
nodes.addAll(createDomNodes(child, componentOwner: childOwner));
}
return nodes;
}
return [createDom(node, componentOwner: componentOwner)];
}