Herramientas de usuario

Herramientas del sitio


wiki2:webcomponents

¡Esta es una revisión vieja del documento!


Web Components

Basic

Concepts

Web components are those functions that allow you to create new custom, reusable, encapsulated HTML tags to use in web pages and web apps. These are the concepts that involve their creation:

  • Custom elements: A set of JavaScript API for creating web components.
  • Shadow DOM: A DOM that is separated from the main one in the document.
  • HTML templates: Tags like <template> or <slot> that enable you to write markup templates.

Steps for creating a web component

  1. Create a class that extends from HtmlElement.
  2. Register it using CustomElementRegistry.define().
  3. If required, atach a shadow DOM Element.attachShadow().
  4. If required define templates with <template> and <slot>.
  5. Use the defined tag.

Resources

wiki2/webcomponents.1590330436.txt.gz · Última modificación: 2020/05/24 15:27 (editor externo)