Polymer / polymer

Our original Web Component library.
https://polymer-library.polymer-project.org/
BSD 3-Clause "New" or "Revised" License
22.05k stars 2.01k forks source link

Accept function in legacy _template field for template parsing #5661

Closed kevinpschaaf closed 4 years ago

kevinpschaaf commented 4 years ago

Polymer's _template field will now accept a template-returning function in addition to a concrete HTMLTemplateElement, to allow for lazy template parsing.

Example:

Polymer({
  is: 'lazy-template',
  _template: () => html`<div>lazy template</div>`;
});

In addition to the previously supported way:

Polymer({
  is: 'eager-template',
  _template: html`<div>eager template</div>`;
});

Reference Issue

Fixes #5660