append方法

  1. @JSName('appendChild')
Node append(
  1. Node node
)

将节点添加到此节点的子节点列表的末尾。

如果节点已存在于该文档中,它会从其当前父节点中移除,然后将其添加到该节点。

此方法比nodes.add更高效,并是添加子节点的方法之一。

实现

@JSName('appendChild')
/**
 * Adds a node to the end of the child [nodes] list of this node.
 *
 * If the node already exists in this document, it will be removed from its
 * current parent node, then added to this node.
 *
 * This method is more efficient than `nodes.add`, and is the preferred
 * way of appending a child node.
 */
Node append(Node node) native;