Skip to content

Commit

Permalink
Enforce same parameters for attachShadow on declarative shadow root
Browse files Browse the repository at this point in the history
Per the discussion at #1235, this PR changes the behavior when calling `attachShadow()` on a node with an existing declarative shadow root. Now, if the parameters do not match between the arguments to `attachShadow()` and the existing root, throw an exception. Prior behavior was to silently return the declarative root as-is, with mismatched parameters.
  • Loading branch information
Mason Freed committed Jan 16, 2024
1 parent 4d07622 commit ffca69f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -6960,8 +6960,14 @@ a boolean <var>delegatesFocus</var>, and a boolean <var>slotAssignment</var>:
<p>If <var>element</var> is a <a for=Element>shadow host</a>, then:

<ol>
<li><p>If <var>element</var>'s <a for=Element>shadow root</a>'s <a for=ShadowRoot>declarative</a>
is false, then <a>throw</a> an "{{NotSupportedError!!exception}}" {{DOMException}}.
<li><p>Let <var>existing root</var> be <var>element</var>'s <a for=Element>shadow root</a>.

<li><p>If <var>existing root</var>'s <a for=ShadowRoot>declarative</a>
is false, or <var>existing root</var>'s <a for=ShadowRoot>mode</a> does not match
<var>mode</var>, or <var>existing root</var>'s <a for=ShadowRoot>delegates focus</a> does
not match <var>delegatesFocus</var>, or <var>existing root</var>'s
<a for=ShadowRoot>slot assignment</a> does not match <var>slotAssignment</var>,
then <a>throw</a> a "{{NotSupportedError!!exception}}" {{DOMException}}.

<li>
<p>Otherwise:
Expand Down

0 comments on commit ffca69f

Please sign in to comment.