diff --git a/source b/source index 4a6e9844f2a..8151f3d6dff 100644 --- a/source +++ b/source @@ -3147,7 +3147,9 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • The tree order and shadow-including tree order concepts
  • The child concept
  • The root and shadow-including root concepts
  • -
  • The inclusive ancestor and shadow-including descendant concepts
  • +
  • The inclusive ancestor, + inclusive descendant, and + shadow-including descendant concepts
  • The first child and next sibling concepts
  • The document element concept
  • The in a document tree, in a document (legacy), and connected concepts
  • @@ -66186,6 +66188,7 @@ interface CustomElementRegistry { [CEReactions] void define(DOMString name, Function constructor, optional ElementDefinitionOptions options); any get(DOMString name); Promise<void> whenDefined(DOMString name); + [CEReactions] void upgrade(Node root); }; dictionary ElementDefinitionOptions { @@ -66243,6 +66246,12 @@ dictionary ElementDefinitionOptions { promise will be immediately fulfilled.) Returns a promise rejected with a "SyntaxError" DOMException if not given a valid custom element name. + +
    window . customElements . upgrade(root)
    + +
    Tries to upgrade all inclusive + descendant elements of root, even if they are not connected.

    Element definition is a process of adding a custom element definition @@ -66462,6 +66471,36 @@ fetch(articleURL) }); +

    When invoked, the upgrade(root) method must run + these steps:

    + +
      +
    1. Let candidates be a list of all of root's + inclusive descendants, in tree order, + that are element nodes.

    2. + +
    3. For each candidate of candidates, + try to upgrade candidate.

    4. +
    + +
    +

    The upgrade() method allows upgrading + of elements at will. Normally elements are automatically upgraded when they become + connected, but this method can be used if you need to upgrade before you're ready to + connect the element.

    + +
    const el = document.createElement("spider-man");
    +
    +class SpiderMan extends HTMLElement {}
    +customElements.define("spider-man", SpiderMan);
    +
    +console.assert(!(el instanceof SpiderMan)); // not yet upgraded
    +
    +customElements.upgrade(el);
    +console.assert(el instanceof SpiderMan);    // upgraded!
    +
    +

    Upgrades

    To upgrade an element, given as