Skip to content
113

Scripting

<template> Template

Inert HTML that the browser parses but does not render, ready for JavaScript to clone.

Live specimen
<template id="row">
  <li class="item"></li>
</template>
<script>
  const li = row.content.cloneNode(true);
</script>

Tip. With shadowrootmode it builds a shadow root right in the HTML, no JavaScript needed.

Since
HTML5
Implicit role
None
Void
No

Attributes
4

  • shadowrootmode
  • shadowrootdelegatesfocus
  • shadowrootclonable
  • shadowrootserializable