A lit-html template expression does not cause any DOM to be created or updated. It's only a description of DOM, called a
TemplateResult. To actually create or update DOM, you need to pass the
TemplateResult to the
render() function, along with a container to render to:
Render OptionsPermalink to “Render Options”
render method also takes an
options argument that allows you to specify the following options:
thisvalue to use when invoking event listeners registered with the
@eventNamesyntax. This option only applies when you specify an event listener as a plain function. If you specify the event listener using an event listener object, the listener object is used as the
thisvalue. See Add event listeners for more on event listeners.
TemplateFactoryto use. This is an advanced option. A
TemplateFactorycreates a template element from a
TemplateResult, typically caching templates based on their static content. Users won't usually supply their own
TemplateFactory, but libraries that use lit-html may implement custom template factories to customize template handling.
shady-rendermodule provides its own template factory, which it uses to preprocess templates to integrate with the shadow DOM polyfills (shadyDOM and shadyCSS).
For example, if you're creating a component class, you might use render options like this:
Render options should not change between subsequent