diff --git a/source b/source index 1a28076a92f..58836a61ca3 100644 --- a/source +++ b/source @@ -3146,6 +3146,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • DocumentType interface
  • ChildNode interface
  • Element interface
  • +
  • attachShadow() method.
  • Node interface
  • NodeList interface
  • ProcessingInstruction interface
  • @@ -10195,6 +10196,8 @@ interface HTMLElement : Element { [CEReactions] attribute DOMString autocapitalize; [CEReactions] attribute [TreatNullAs=EmptyString] DOMString innerText; + + ElementInternals attachInternals(); }; HTMLElement includes GlobalEventHandlers; @@ -66612,6 +66615,14 @@ document.body.append(parent); href="#html-element-constructors">HTML element constructors. Each entry in the list will be either an element or an already constructed marker. + +
    A disable + internals boolean
    +
    Controls attachInternals(). + +
    A disable shadow boolean
    +
    Controls attachShadow().

    To look up a custom element definition, given a document, @@ -66785,6 +66796,13 @@ dictionary ElementDefinitionOptions {

  • Set this CustomElementRegistry's element definition is running flag.

  • +
  • Let disableInternals be false. + +

  • Let disableShadow be false. + +

  • Let observedAttributes be an empty sequence<DOMString>.

  • +
  • Run the following substeps while catching any exceptions:

    @@ -66816,9 +66834,6 @@ dictionary ElementDefinitionOptions {
  • -
  • Let observedAttributes be an empty sequence<DOMString>.

  • -
  • If the value of the entry in lifecycleCallbacks with key "attributeChangedCallback" is not null, then:

    @@ -66834,6 +66849,24 @@ dictionary ElementDefinitionOptions { sequence<DOMString>. Rethrow any exceptions from the conversion.

  • + +
  • Let disabledFeatures be an empty sequence<DOMString>.

  • + +
  • Let disabledFeaturesIterable be Get(constructor, "disabledFeatures"). Rethrow any + exceptions.

  • + +
  • If disabledFeaturesIterable is not undefined, then set + disabledFeatures to the result of converting disabledFeaturesIterable to a sequence<DOMString>. Rethrow any exceptions from the conversion.

  • + +
  • Set disableInternals to true if disabledFeaturesSequence + contains "internals".

  • + +
  • Set disableShadow to true if disabledFeaturesSequence + contains "shadow".

  • Then, perform the following substep, regardless of whether the above steps threw an exception @@ -66854,9 +66887,13 @@ dictionary ElementDefinitionOptions { constructor constructor, observed attributes - observedAttributes, and observedAttributes, lifecycle callbacks - lifecycleCallbacks.

    + lifecycleCallbacks, disable internals + disableInternals, and disable shadow + disableShadow.

  • Add definition to this CustomElementRegistry.

  • @@ -67429,6 +67466,61 @@ customElements.define("x-foo", class extends HTMLElement { +

    The ElementInternals interface

    + +
    +
    element . attachInternals()
    + +

    Returns an ElementInternals object targeting the custom element + element. Throws an exception if element is not a custom + element, if the "internals" feature was disabled as part of the + element definition, or if it is called twice on the same element.

    +
    + +
    [Exposed=Window]
    +interface ElementInternals {
    +  
    +};
    + + + +

    Each ElementInternals has a target element, + which is a custom element. ElementInternals provides various operations + and attributes to allow control over internal features which the user agent provides to all + elements.

    + +

    Each HTMLElement has an attached internals boolean, initially + false.

    + +

    The attachInternals() method on + an HTMLElement element, when invoked, must run the following steps:

    + +
      + +
    1. If element's is value is not null, then throw a + "NotSupportedError" DOMException.

    2. + +
    3. Let definition be the result of looking up a custom element definition given + element's node document, its namespace, its local name, and null as + is value.

    4. + +
    5. If definition is null, then throw an + "NotSupportedError" DOMException.

    6. + +
    7. If definition's disable internals is true, + then throw a "NotSupportedError" DOMException.

    8. + +
    9. If element's attached internals is true, then throw an + "NotSupportedError" DOMException.

    10. + +
    11. Set element's attached internals to true.

    12. + +
    13. Create a new ElementInternals instance + targeting element, and return it.

    14. +

    Common idioms without dedicated elements