insertAllBefore 方法

void insertAllBefore(
  1. Iterable<Node> newNodes,
  2. Node child
)

将所有节点插入当前节点中,直接位于 child 之前。

另请参阅

实现

void insertAllBefore(Iterable<Node> newNodes, Node child) {
  if (newNodes is _ChildNodeListLazy) {
    _ChildNodeListLazy otherList = newNodes;
    if (identical(otherList._this, this)) {
      throw new ArgumentError(newNodes);
    }

    // Optimized route for copying between nodes.
    for (var i = 0, len = otherList.length; i < len; ++i) {
      this.insertBefore(otherList._this.firstChild!, child);
    }
  } else {
    for (var node in newNodes) {
      this.insertBefore(node, child);
    }
  }
}