Re: [whatwg/dom] Enforce same parameters for attachShadow on declarative shadow root (PR #1246)

@annevk commented on this pull request.



> @@ -6958,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>.

Nit: _currentShadowRoot_

> @@ -6958,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}}.

I think we should make this a list. Something like:

> If one of the following is true:
>
> 1. _currentShadowRoot_'s declarative is false,
> 2. ...
>
> then ...

I wonder if there's also a place where we can add a comment to not forgot about this when we add a new member.

Speaking of, this does not seem to check clonable?

> @@ -4502,6 +4502,8 @@ dom-Range-extractContents, dom-Range-cloneContents -->
   <a for=ShadowRoot>clonable</a> is true:
 
   <ol>
+   <li><p>Assert: <var>copy</var> is not a <span>shadow host</span>.

DOM uses `<a>`, not `<span>`.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1246#pullrequestreview-1835865665
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/pull/1246/review/1835865665@github.com>

Received on Monday, 22 January 2024 08:30:49 UTC