From 531e50de18697f347f5c896ab40ad66f99545c40 Mon Sep 17 00:00:00 2001 From: Mason Freed Date: Tue, 13 Feb 2024 04:32:35 -0800 Subject: [PATCH] Add shadowrootclonable attribute And make declarative shadow roots not clonable by default. Closes #10107. Co-authored-by: Anne van Kesteren --- source | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/source b/source index 2e50ea4d8f4..9b91774e979 100644 --- a/source +++ b/source @@ -3131,7 +3131,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • node document concept
  • document type concept
  • host concept
  • -
  • The shadow root concept, and its delegates focus and available to element internals.
  • +
  • The shadow root concept, and its delegates focus, available to element internals, and clonable.
  • The shadow host concept
  • HTMLCollection interface, its length attribute, and its @@ -63166,6 +63166,7 @@ not-slash = %x0000-002E / %x0030-10FFFF
    Global attributes
    shadowrootmode
    shadowrootdelegatesfocus
    +
    shadowrootclonable
    Accessibility considerations:
    For authors.
    @@ -63179,6 +63180,7 @@ interface HTMLTemplateElement : HTMLElement { readonly attribute DocumentFragment content; [CEReactions] attribute DOMString shadowRootMode; [CEReactions] attribute boolean shadowRootDelegatesFocus; + [CEReactions] attribute boolean shadowRootClonable; };
    Uses HTMLTemplateElement.
    @@ -63219,6 +63221,10 @@ interface HTMLTemplateElement : HTMLElement { data-x="attr-template-shadowrootdelegatesfocus">shadowrootdelegatesfocus content attribute is a boolean attribute.

    +

    The shadowrootclonable content attribute is a + boolean attribute.

    +

    The template contents of a template element are not children of the element itself.

    @@ -63360,6 +63366,10 @@ interface HTMLTemplateElement : HTMLElement { data-x="attr-template-shadowrootdelegatesfocus">shadowrootdelegatesfocus content attribute.

    +

    The shadowRootClonable IDL + attribute must reflect the shadowrootclonable content attribute.

    +

    The cloning steps for a template @@ -126130,17 +126140,20 @@ document.body.appendChild(text);

  • Let template be the result of insert a foreign element for template start tag, with HTML namespace and true.

  • -
  • Let declarative shadow mode be template start tag's - shadowrootmode attribute.

  • +
  • Let mode be template start tag's shadowrootmode attribute's value.

  • + +
  • Let clonable be true if template start tag has a shadowrootclonable attribute; otherwise + false.

  • -
  • If template start tag had a - shadowrootdelegatesfocus - attribute, then let declarative shadow delegates focus be true. Otherwise let - it be false.

  • +
  • Let delegatesFocus be true if template start tag has a shadowrootdelegatesfocus attribute; + otherwise false.

  • Attach a shadow root with - declarative shadow host element, declarative shadow mode, true, - declarative shadow delegates focus, and "named".

  • + declarative shadow host element, mode, clonable, + delegatesFocus, and "named".

  • If an exception was thrown by attach a @@ -139043,10 +139056,15 @@ interface External { "open"; "closed" - shadowrootdelegatesfocus - template - Sets delegates focus on a declarative shadow root - Boolean attribute + shadowrootdelegatesfocus + template + Sets delegates focus on a declarative shadow root + Boolean attribute + + shadowrootclonable + template + Sets clonable on a declarative shadow root + Boolean attribute shape area