Skip to content

Commit 780b8dd

Browse files
authored
Allow passing null for customElementRegistry
Apparently people are passing a ShadowRoot instance as the argument to attachShadow(). Context: https://bugs.webkit.org/show_bug.cgi?id=295174. Tests are added as part of that fix.
1 parent 7792009 commit 780b8dd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

dom.bs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6598,10 +6598,14 @@ dictionary ShadowRootInit {
65986598
SlotAssignmentMode slotAssignment = "named";
65996599
boolean clonable = false;
66006600
boolean serializable = false;
6601-
CustomElementRegistry customElementRegistry;
6601+
CustomElementRegistry? customElementRegistry = null;
66026602
};
66036603
</pre>
66046604

6605+
<p class=note>{{ShadowRootInit}} somewhat unusually allows both <code>undefined</code> and
6606+
<code>null</code> to be passed to its {{ShadowRootInit/customElementRegistry}} member to allow web
6607+
developers to pass a {{ShadowRoot}} node instead of a dictionary to {{Element/attachShadow()}}.
6608+
66056609
<p>{{Element}} <a for=/>nodes</a> are simply known as
66066610
<dfn export id=concept-element lt=element>elements</dfn>.
66076611

@@ -7509,8 +7513,8 @@ are:
75097513
<ol>
75107514
<li><p>Let <var>registry</var> be <a>this</a>'s <a for=Element>custom element registry</a>.
75117515

7512-
<li><p>If <var>init</var>["{{ShadowRootInit/customElementRegistry}}"] <a for=map>exists</a>, then
7513-
set <var>registry</var> to it.
7516+
<li><p>If <var>init</var>["{{ShadowRootInit/customElementRegistry}}"] is non-null, then set
7517+
<var>registry</var> to it.
75147518

75157519
<li><p>Run <a>attach a shadow root</a> with <a>this</a>,
75167520
<var>init</var>["{{ShadowRootInit/mode}}"], <var>init</var>["{{ShadowRootInit/clonable}}"],

0 commit comments

Comments
 (0)