clone method

Selection clone(
  1. bool deep
)

Inserts clones of the selected elements immediately following the selected elements and returns a selection of the newly added clones.

If deep is truthy, the descendant nodes of the selected elements will be cloned as well. Otherwise, only the elements themselves will be cloned. Equivalent to:

selection.select((Element thisArg, JSAny? d, int i, List<Element?> nodes) {
  return (thisArg.parentNode!
      .insertBefore(thisArg.cloneNode(deep), thisArg.nextSibling) as Element);
}.u21);

Implementation

Selection clone(bool deep) {
  return select((deep ? cloneDeep : cloneShallow).u21);
}