const cloned = ele.cloneNode(true);
cloneNode(true)
method will deep copy a given element. In the sample code above, all attributes and children of the original node ele
will be cloned in cloned
as well.false
produces a cloned node that keeps only the attributes and the original node:const cloned = ele.cloneNode(false);