mapTree method

bool mapTree(
  1. DOMNode domRoot,
  2. T root
)

Implementation

bool mapTree(DOMNode domRoot, T root) {
  if (root == null) return false;
  map(domRoot, root);

  if (domRoot is TextNode) return false;

  var domNodes = domRoot.nodes.toList();
  var nodes = domGenerator.getElementNodes(root);

  var limit = Math.min(domNodes.length, nodes.length);

  for (var i = 0; i < limit; i++) {
    var domNode = domNodes[i];
    var node = nodes[i];

    if (domGenerator.isEquivalentNode(domNode, node)) {
      mapTree(domNode, node);
    }
  }

  return true;
}