Minimal WebComponent

by amindunited

HTML

<min-wc>This is slotted content</min-wc>

JavaScript

class MinimalWc extends HTMLElement {
  constructor() {
    super();
    this.shadow = this.attachShadow({mode: 'open'});
  }
  connectedCallback () {
    this.shadow.innerHTML = `
    	Shadowy
      <slot></slot>
		`;
  }
}

customElements.define('min-wc', MinimalWc);