© Carlos Rojas 2021
C. RojasBuilding Native Web Componentshttps://doi.org/10.1007/978-1-4842-5905-4_3

3. HTML Template

Carlos Rojas1 
(1)
Medellin, Colombia
 

In this chapter, we are going to examine HTML Template, another specification in the Web Components set. You are going to learn what an HTML Template is and how to use HTML templates in web components. We then will build a new web component for our collection.

What Is an HTML Template?

The HTML Template specification defines the <template> element, to create fragments of markup to be unused in our custom element until we activate them later on runtime. These fragments can be cloned and inserted in HTML by script.

The content inside a <template> has the following properties:
  • The content will not render ...

Get Building Native Web Components: Front-End Development with Polymer and Vue.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.