Get the latest tech news

<template>: The Content Template element


The <template> HTML element serves as a mechanism for holding HTML fragments, which can either be used later via JavaScript or generated immediately into shadow DOM.

Note: The HTML parser creates a ShadowRoot object in the DOM for the first<template> in a node with this attribute set to an allowed value. If the<template> element contains the shadowrootmode attribute with a value of either open or closed, the HTML parser will immediately generate a shadow DOM. Similarly, if there are multiple declarative shadow roots, only the first one is replaced by a ShadowRoot — subsequent instances are parsed as HTMLTemplateElement objects.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of template

template

Related news:

News photo

Speeding up C++ code with template lambdas

News photo

Make Any File a Template Using This Hidden macOS Tool

News photo

YouTube highlights longer Shorts and a 'template' to hop on trends