up.template.clone(template, [data], [options])
JavaScript function
Clones a template element.
Emits the up:template:clone event. You can use that event to integrate template engines
like Mustache, EJS or Handlebars.
Example
let nodes = up.template.clone('#table-placeholder')
up.render({ fragment: nodes[0] })
Passing variables
Any template variables can be passed as a second argument:
let nodes = up.template.clone('#table-placeholder', { rows: 10 })
Parameters
template
required
The element to clone.
This is usually a <template> element or a <script> with a custom type.
You may also pass a selector for the element to clone.
Type: string | Element
[data={}]
[options.origin]
Return value
A list of Node objects that represent
the cloned templates.
You can pass this list to any rendering function, like up.render() or up.Preview#insert().