danieldietrich / candid

Candid is a surprisingly fresh and frameworkless JavaScript library for building web applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove web component definitions from DOM after defining them?

danieldietrich opened this issue · comments

It does not make sense to keep child web components (that are children of a web component's template) because the row content is copied to the DOM, including the template.

Screen Shot 2022-02-03 at 01 28 18

Decision

  • we should remove child web components when processing a template

Implications

  • we remove all web components from the html page
  • we need to process web imports first, currently we need to process them last because otherwise we seem to define custom elements multiple times then, which leads to errors
  • we don't need to set the status anymore on web import tags, which simplifies the code, we just log error on the console

Related

We should hide tags. This can be either done with CSS:

web-component, web-import {
  display: none !important;
}

Alternatively this can be done declaratively:

<web-component name="..." hide></web-component>

<web-import src="..." hide></web-component>

Fixed in the upcoming PR (no need to remove something from the DOM).

Screen Shot 2022-02-06 at 14 32 15