cloneNode()

The DOM method that copies a node; with the argument true it copies the whole subtree as well.

In more detail

template.content.cloneNode(true) produces a fresh, independent copy of the blueprint each time. Event listeners added with addEventListener are not copied.

Related terms

Taught in

References