Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce same parameters for attachShadow on declarative shadow root #1246

Merged
merged 8 commits into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions dom.bs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a for=Element>shadow host</a>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(It's weird that this has for=Element, but that's a pre-existing issue.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want me to change something?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to take it on, it should be a separate PR making it a standalone term that doesn't belong to Element.


<li><p>Run <a>attach a shadow root</a> with <var>copy</var>, <var>node</var>'s
<a for=Element>shadow root</a>'s <a for=ShadowRoot>mode</a>, true, <var>node</var>'s
<a for=Element>shadow root</a>'s <a for=ShadowRoot>delegates focus</a>, and <var>node</var>'s
Expand Down Expand Up @@ -6929,7 +6931,7 @@ are:
<div algorithm>
<p>To <dfn id=concept-attach-a-shadow-root>attach a shadow root</dfn>, given an
<a for=/>element</a> <var>element</var>, a string <var>mode</var>, a boolean <var>clonable</var>,
a boolean <var>delegatesFocus</var>, and a boolean <var>slotAssignment</var>:
a boolean <var>delegatesFocus</var>, and a string <var>slotAssignment</var>:
mfreed7 marked this conversation as resolved.
Show resolved Hide resolved

<ol>
<li><p>If <var>element</var>'s <a for=Element>namespace</a> is not the <a>HTML namespace</a>,
Expand Down Expand Up @@ -6958,24 +6960,30 @@ 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>currentShadowRoot</var> be <var>element</var>'s <a for=Element>shadow root</a>.

<li>
<p>If any of the following are true:

<ul>
<li><p><var>currentShadowRoot</var>'s <a for=ShadowRoot>declarative</a> is false; or

<li><p><var>currentShadowRoot</var>'s <a for=ShadowRoot>mode</a> is not <var>mode</var>,
</ul>

<p>then <a>throw</a> a "{{NotSupportedError!!exception}}" {{DOMException}}.

<li>
<p>Otherwise:

<ol>
<li><p><a for=/>Remove</a> all of <var>element</var>'s <a for=Element>shadow root</a>'s
<a for=tree>children</a>, in <a>tree order</a>.
<li><p><a for=/>Remove</a> all of <var>currentShadowRoot</var>'s <a for=tree>children</a>, in
<a>tree order</a>.

<li><p>Set <var>element</var>'s <a for=Element>shadow root</a>'s
<a for=ShadowRoot>declarative</a> to false.
<li><p>Set <var>currentShadowRoot</var>'s <a for=ShadowRoot>declarative</a> to false.

<li><p>Return.
</ol>

<p class=note>This means that if multiple declarative shadow roots are contained within a single
shadow host, only the last one will remain.
</ol>

<li><p>Let <var>shadow</var> be a new <a for=/>shadow root</a> whose <a for=Node>node document</a>
Expand Down
Loading