diff --git a/source b/source index 4a6e9844f2a..9ce33ee48bf 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, + shadow-including descendant, and + shadow-including inclusive 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,13 @@ 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 shadow-including + inclusive descendant elements of root, even if they are not + connected.

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

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

    + +
      +
    1. Let candidates be a list of all of root's + shadow-including inclusive descendant elements, in tree order.

    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