diff --git a/source b/source index 48daf9ac1af..1b67a526b0b 100644 --- a/source +++ b/source @@ -3198,7 +3198,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
HTMLCollection interface, its
length attribute, and its
@@ -3307,6 +3307,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
Documentis valueLet registry be current global object's custom element registry.
If NewTarget is equal to the active function
object, then throw a TypeError.
Let registry be null.
If the surrounding agent's active custom element constructor + map[NewTarget] exists:
+ +Set registry to the surrounding agent's active custom + element constructor map[NewTarget].
Remove the surrounding agent's + active custom element constructor map[NewTarget].
Otherwise, set registry to current global object's associated Document's custom element registry.
Let definition be the item in registry's custom element
definition set with shadowrootdelegatesfocus
shadowrootclonableshadowrootserializableshadowrootcustomelementregistryHTMLTemplateElement.
The shadowrootcustomelementregistry
+ content attribute is a boolean attribute.
The template contents of a template element are not children of the element itself.
shadowrootserializable content attribute.
+ The shadowRootCustomElementRegistry
+ IDL attribute must reflect the shadowrootcustomelementregistry
+ content attribute.
The IDL attribute does intentionally not have a boolean type so it can be + extended.
+The cloning steps for template
@@ -73498,8 +73532,8 @@ document.body.append(parent);
A custom element definition describes a custom element and consists - of:
+A custom element definition describes a custom element and + consists of:
attachShadow().
To look up a custom element definition, given a document, - namespace, localName, and is, perform the following steps. They - will return either a custom element definition or null:
+To look up a custom element definition, given null or a
+ CustomElementRegistry object registry, string-or-null
+ namespace, string localName, and string-or-null is, perform the
+ following steps. They will return either a custom element definition or null:
If namespace is not the HTML namespace, then return null.
If registry is null, then return null.
If document's browsing context is - null, then return null.
Let registry be document's relevant global object's - custom element registry.
If namespace is not the HTML namespace, then return null.
If registry's custom element definition set contains an item with The Each Custom element registries are associated with The Each similar-origin window agent has an associated active custom element constructor map, which is a map of constructors to The Every Every Every To look up a custom element registry, given an If node is an If node is a Return node's custom element
+ registry. The Element definition is a process of adding a custom element definition
to the If extends is not null: If this's is scoped is true, then throw a
+ " If extends is a valid custom element name, then throw a
" Append definition to this's
custom element definition set. Let document be this's relevant global object's associated If this's is scoped is true, then for each document
+ of this's scoped document set: upgrade particular elements within
+ a document given document and localName. Let upgradeCandidates be all elements that are shadow-including descendants of document, whose namespace
- is the HTML namespace and whose local name is localName, in
- shadow-including tree order. Additionally, if extends is non-null, only
- include elements whose For each element element of upgradeCandidates, enqueue a
- custom element upgrade reaction given element and
- definition. Otherwise, upgrade particular elements within a document given
+ this's relevant global object's associated If this's when-defined promise map[name] shadow-including descendants of document, whose namespace
+ is the HTML namespace and whose local name is localName, in
+ shadow-including tree order. Additionally, if name is not
+ localName, only include elements whose For each element element of upgradeCandidates: enqueue a
+ custom element upgrade reaction given element and
+ definition. The When invoked, the The Let candidates be a list of all of root's
@@ -73996,6 +74068,43 @@ console.assert(el instanceof SpiderMan); // upgraded!
The If root is a Otherwise, if root is a For each inclusive descendant inclusiveDescendant of root:
+ if inclusiveDescendant is an Set inclusiveDescendant's custom element registry to
+ this. If this's is scoped is true, then append inclusiveDescendant's node document to
+ this's scoped document set. Once the custom element registry of a node is initialized to a
+ To upgrade an element, given as input a
@@ -74067,8 +74176,14 @@ customElements.define("x-foo", class extends HTMLElement {
Let C be definition's constructor. Let registry be element's custom element registry. Set the surrounding agent's active custom
+ element constructor map[C] to registry. Run the following substeps while catching any exceptions: Run the following steps while catching any exceptions: Then, perform the following substep, regardless of whether the above steps threw an exception
+ Then, perform the following steps, regardless of whether the above steps threw an exception
or not: Remove registry's relevant global
+ object's active custom element constructor map[C]. This is a no-op if C immediately calls Remove the last entry from the end of definition's construction stack. To try to upgrade an element, given as input an
- element element, run the following steps: To try to upgrade an element given an element
+ element: Let definition be the result of looking up a custom element definition given element's node
- document, element's namespace, element's local name, and
- element's If definition is not null, then enqueue a custom element upgrade
reaction given element and definition. Let definition be the result of looking up a custom element definition given this's node
- document, its namespace, its local name, and null as the If definition is null, then throw an
" Let is be the value of the " Let registry be the result of looking up a custom element registry given intended parent. Let definition be the result of looking up a custom element definition given document, given
+ definition">looking up a custom element definition given registry, given
namespace, local name, and is. Let willExecuteScript be true if definition is non-null and the
@@ -130655,7 +130789,7 @@ dictionary StorageEventInit : EventInit {
Let element be the result of creating an
element given document, localName, given namespace,
- null, is, and willExecuteScript. This will cause custom element
constructors to run, if willExecuteScript is true. However, since we
@@ -131536,7 +131670,8 @@ document.body.appendChild(text);
Attach a shadow root with
declarative shadow host element, mode, clonable,
- serializable, delegatesFocus, and " If an exception is thrown, then catch it and: Set shadow's available to element internals to true. If template start tag has a If shadow's clonable is set, then append
" If current node's custom
+ element registry is not shadow's custom element registry, then append
+ " Append " Append the value of running the HTML fragment serialization algorithm with
@@ -135777,8 +135922,9 @@ console.assert(container.firstChild instanceof SuperP);
Let root be the result of creating an
- element given document, " Append root to
document.CustomElementRegistry interface
- Window object has an associated custom element registry (a
- CustomElementRegistry object). It is set to a new
- CustomElementRegistry object when the Window object is created.Window objects, instead
- of Document objects, since each custom element constructor inherits from
- the HTMLElement interface, and there is exactly one HTMLElement
- interface per Window object.customElements attribute of the
- Window interface must return the CustomElementRegistry object for that
- Window object.CustomElementRegistry objects.Window customElements getter steps are to return
+ this's associated
+ Document's custom element
+ registry.
+ [Exposed=Window]
interface CustomElementRegistry {
- [CEReactions] undefined define(DOMString name, CustomElementConstructor constructor, optional ElementDefinitionOptions options = {});
- (CustomElementConstructor or undefined) get(DOMString name);
- DOMString? getName(CustomElementConstructor constructor);
- Promise<CustomElementConstructor> whenDefined(DOMString name);
- [CEReactions] undefined upgrade(Node root);
+ constructor();
+
+ [CEReactions] undefined define(DOMString name, CustomElementConstructor constructor, optional ElementDefinitionOptions options = {});
+ (CustomElementConstructor or undefined) get(DOMString name);
+ DOMString? getName(CustomElementConstructor constructor);
+ Promise<CustomElementConstructor> whenDefined(DOMString name);
+ [CEReactions] undefined upgrade(Node root);
+ undefined initialize((Node) root);
};
callback CustomElementConstructor = HTMLElement ();
@@ -73617,6 +73646,12 @@ dictionary ElementDefinitionOptions {
DOMString extends;
};CustomElementRegistry has an is
+ scoped, a boolean, initially false.CustomElementRegistry has a scoped
+ document set, a set of Document objects, initially « ».CustomElementRegistry has a custom element definition set, a
set of custom element definitions,
initially « ». Lookup of items in this set uses their ElementDefinitionOptions {
element names to promises. It is used to implement the whenDefined() method.Element object,
+ ShadowRoot object, or Document object node:
+
+
Element object, then return node's custom element registry.ShadowRoot object, then return node's
+ custom element registry.
-
+ window.customElements.define(name,
- constructor)registry = window.customElementsDocument's CustomElementRegistry
+ object.registry = new CustomElementRegistry()CustomElementRegistry object, for scoped usage.registry.define(name,
+ constructor)window.customElements.define(name, constructor,
+ registry.define(name, constructor,
{ extends: baseLocalName })NotSupportedError"
DOMException will be thrown upon trying to extend a custom element or
- an unknown element.window.customElements.get(name)CustomElementRegistry object.
+ registry.get(name)window.customElements.getName(constructor)registry.getName(constructor)window.customElements.whenDefined(name)registry.whenDefined(name)SyntaxError" DOMException if not
given a valid custom element name.window.customElements.upgrade(root)registry.upgrade(root)registry.initialize(root)CustomElementRegistry object.new CustomElementRegistry() constructor
+ steps are to set this's is scoped to true.CustomElementRegistry. This is accomplished by the define() method. The ElementDefinitionOptions {
+
+
+
NotSupportedError" DOMException.NotSupportedError" DOMException.Document.is
- value is equal to name.Document, localName,
+ and name.is value is equal to name.get(name) method steps are:upgrade(root) method must run
- these steps:upgrade(root) method steps
+ are:
initialize(root) method
+ steps are:
+
+
+ Document node whose custom element registry is null, then set
+ root's custom element registry
+ to this.ShadowRoot node whose custom element registry is null, then set
+ root's custom element
+ registry to this.Element node whose custom element registry is null:
+
+ CustomElementRegistry object, it intentionally cannot be changed any further. This
+ simplifies reasoning about code and allows implementations to optimize.Upgrades
-
+
- super() as it ought to do.custom".
is
- value.is value.DOMException.
is value.NotSupportedError" DOMException.is" attribute in the
given token, if such an attribute exists, or null otherwise.named".named", and
+ registry.
shadowrootcustomelementregistry
+ attribute, then set shadow's keep custom element registry null to
+ true. shadowrootclonable=""". shadowrootcustomelementregistry=""".>".html", and the HTML
- namespace.html", the HTML
+ namespace, null, null, false, and context's custom element registry.
shadowrootmode;
shadowrootdelegatesfocus;
shadowrootclonable;
- shadowrootserializable
+ shadowrootserializable;
+ shadowrootcustomelementregistry
@@ -144531,6 +144678,11 @@ interface External {
HTMLTemplateElement template
Sets clonable on a declarative shadow root
Boolean attribute
+
+ shadowrootcustomelementregistry
+ template
+ Enables declarative shadow roots to indicate they will use a custom element registry
+ Boolean attribute
shadowrootdelegatesfocus
template