duplicateNode method

DOMNode? duplicateNode(
  1. DOMNode node
)

Duplicate node and add it to the children list.

Implementation

DOMNode? duplicateNode(DOMNode node) {
  if (isEmptyContent) return null;

  var idx = indexOfNodeIdenticalFirst(node);
  if (idx < 0) return null;

  var elem = _content![idx];
  var copy = elem.copy();
  _content!.insert(idx + 1, copy);

  copy.parent = this;

  return copy;
}