copyTo method

Future<NodeId> copyTo(
  1. NodeId nodeId,
  2. NodeId targetNodeId, {
  3. NodeId? insertBeforeNodeId,
})

Creates a deep copy of the specified node and places it into the target container before the given anchor. nodeId Id of the node to copy. targetNodeId Id of the element to drop the copy into. insertBeforeNodeId Drop the copy before this node (if absent, the copy becomes the last child of targetNodeId). Returns: Id of the node clone.

Implementation

Future<NodeId> copyTo(NodeId nodeId, NodeId targetNodeId,
    {NodeId? insertBeforeNodeId}) async {
  var result = await _client.send('DOM.copyTo', {
    'nodeId': nodeId,
    'targetNodeId': targetNodeId,
    if (insertBeforeNodeId != null) 'insertBeforeNodeId': insertBeforeNodeId,
  });
  return NodeId.fromJson(result['nodeId'] as int);
}