JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1237
  • Score
    100M100P100Q109388F
  • License ISC

A base custom element class with a reliable `parsedCallback` method

Package Exports

  • html-parsed-element

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (html-parsed-element) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

html-parsed-element

Build Status Coverage Status

A base custom element class with a reliable parsedCallback method and a parsed getter.

Class born after discussing why connectedCallback is considered harmful and how to properly setup any custom element.

Based off the contributions by @franktopel and @irhadkul.

customElements.define(
  'custom-element',
  class extends HTMLParsedElement {
    parsedCallback() {
      this.innerHTML = 'always <strong>safe</strong>!';
      console.log(this.parsed); // always true here
    }
  }
);