duplicateByDOMNode method

DOMNodeMapping<T>? duplicateByDOMNode(
  1. DOMNode? domNode
)

Duplicates domNode in the parent children list. Also performs on mapped element.

Implementation

DOMNodeMapping<T>? duplicateByDOMNode(DOMNode? domNode) {
  if (domNode == null || !domNode.hasParent) return null;

  var nodeRuntime = domNode.runtime;

  var domCopy = domNode.duplicate();
  var copy = nodeRuntime.duplicate();

  if (domCopy == null && copy == null) return null;

  if (domCopy != null && copy != null) {
    mapTree(domCopy, copy);
  }

  return DOMNodeMapping(this, domCopy!, copy);
}