-
Notifications
You must be signed in to change notification settings - Fork 318
Set registry on null registry element on adopt instead of on insert #1423
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2899,15 +2899,11 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run | |||||||||||||||||||||||||||||||
| <a for=iteration>continue</a>. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <li> | ||||||||||||||||||||||||||||||||
| <p>If <var>inclusiveDescendant</var> is an <a for=/>element</a>: | ||||||||||||||||||||||||||||||||
| <p>If <var>inclusiveDescendant</var> is an <a for=/>element</a> and | ||||||||||||||||||||||||||||||||
| <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a> is non-null: | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <ol> | ||||||||||||||||||||||||||||||||
| <li><p>If <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a> is | ||||||||||||||||||||||||||||||||
| null, then set <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a> to | ||||||||||||||||||||||||||||||||
| the result of <a for=/>looking up a custom element registry</a> given | ||||||||||||||||||||||||||||||||
| <var>inclusiveDescendant</var>'s <a for=tree>parent</a>. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <li><p>Otherwise, if <var>inclusiveDescendant</var>'s | ||||||||||||||||||||||||||||||||
| <li><p>If <var>inclusiveDescendant</var>'s | ||||||||||||||||||||||||||||||||
| <a for=Element>custom element registry</a>'s <a for=CustomElementRegistry>is scoped</a> is | ||||||||||||||||||||||||||||||||
| true, <a for=set>append</a> <var>inclusiveDescendant</var>'s <a for=Node>node document</a> to | ||||||||||||||||||||||||||||||||
| <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a>'s | ||||||||||||||||||||||||||||||||
|
|
@@ -2930,14 +2926,7 @@ before a <var>child</var>, with an optional <i>suppress observers flag</i>, run | |||||||||||||||||||||||||||||||
| <p>Otherwise, if <var>inclusiveDescendant</var> is a <a for=/>shadow root</a>: | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <ol> | ||||||||||||||||||||||||||||||||
| <li><p>If <var>inclusiveDescendant</var>'s <a for=ShadowRoot>custom element registry</a> is | ||||||||||||||||||||||||||||||||
| null and <var>inclusiveDescendant</var>'s | ||||||||||||||||||||||||||||||||
| <a for=ShadowRoot>keep custom element registry null</a> is false, then set | ||||||||||||||||||||||||||||||||
| <var>inclusiveDescendant</var>'s <a for=ShadowRoot>custom element registry</a> to the result | ||||||||||||||||||||||||||||||||
| of <a for=/>looking up a custom element registry</a> given <var>inclusiveDescendant</var>'s | ||||||||||||||||||||||||||||||||
| <a for=DocumentFragment>host</a>. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <li><p>Otherwise, if <var>inclusiveDescendant</var>'s | ||||||||||||||||||||||||||||||||
| <li><p>If <var>inclusiveDescendant</var>'s | ||||||||||||||||||||||||||||||||
| <a for=ShadowRoot>custom element registry</a> is non-null and | ||||||||||||||||||||||||||||||||
| <var>inclusiveDescendant</var>'s <a for=ShadowRoot>custom element registry</a>'s | ||||||||||||||||||||||||||||||||
| <a for=CustomElementRegistry>is scoped</a> is true, <a for=set>append</a> | ||||||||||||||||||||||||||||||||
|
|
@@ -6018,11 +6007,16 @@ these steps: | |||||||||||||||||||||||||||||||
| <ol> | ||||||||||||||||||||||||||||||||
| <li><p>Set <var>inclusiveDescendant</var>'s <a for=Node>node document</a> to <var>document</var>. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <li><p>If <var>inclusiveDescendant</var> is a <a for=/>shadow root</a> and | ||||||||||||||||||||||||||||||||
| <var>inclusiveDescendant</var>'s <a for=ShadowRoot>custom element registry</a> | ||||||||||||||||||||||||||||||||
| <a>is a global custom element registry</a>, then set <var>inclusiveDescendant</var>'s | ||||||||||||||||||||||||||||||||
| <a for=ShadowRoot>custom element registry</a> to <var>document</var>'s | ||||||||||||||||||||||||||||||||
| <a>effective global custom element registry</a>. | ||||||||||||||||||||||||||||||||
| <li> | ||||||||||||||||||||||||||||||||
| <p>If <var>inclusiveDescendant</var> is a <a for=/>shadow root</a>: | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <ol> | ||||||||||||||||||||||||||||||||
| <li><p>if <var>inclusiveDescendant</var>'s <a for=ShadowRoot>custom element registry</a> | ||||||||||||||||||||||||||||||||
| is null or <var>inclusiveDescendant</var>'s <a for=ShadowRoot>custom element registry</a>'s | ||||||||||||||||||||||||||||||||
| <a for=CustomElementRegistry>is scoped</a> is false, then set | ||||||||||||||||||||||||||||||||
| <var>inclusiveDescendant</var>'s <a for=ShadowRoot>custom element registry</a> to | ||||||||||||||||||||||||||||||||
| <var>document</var>'s <a>effective global custom element registry</a>. | ||||||||||||||||||||||||||||||||
|
Comment on lines
+6010
to
+6018
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But I think this is incorrect and we still need "keep custom element registry null" here. Have you looked at how the HTML Standard sets "keep custom element registry null"? How is the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In HTML spec where we define the parsing logic for "A start tag whose tag name is "template", we have two repetitive lines describing how
I think we can remove that second line and completely remove the usage of "keep custom element registry null" and we can simply rely on setting the shadowroot's registry to null to support
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do we distinguish the case of a shadow root from a null document registry without the attribute from one with the attribute?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to have a DSD with null registry due to In that case, we can safely assign a registry to null registry shadow root on adopt and remove the need of "keep custom element registry" as we don't assign registry on append regardless. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It can be created with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @annevk Is this the reason or related to it that you're suggesting we still need the check? To distinguish these cases? <template id="template">
<div id="host1">
<template shadowrootmode="open"><x-foo></x-foo></template>
</div>
<div id="host2">
<template shadowrootmode="open" shadowrootcustomelementregistry><x-foo></x-foo></template>
</div>
</template>customElements.define('x-foo', class extends HTMLElement {});
document.body.append(template.content.cloneNode(true));
console.assert(host1.shadowRoot.querySelector('x-foo:defined') === true);
console.assert(host2.shadowRoot.querySelector('x-foo:defined') === false); |
||||||||||||||||||||||||||||||||
| </ol> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <li> | ||||||||||||||||||||||||||||||||
| <p>Otherwise, if <var>inclusiveDescendant</var> is an <a for=/>element</a>: | ||||||||||||||||||||||||||||||||
|
|
@@ -6032,9 +6026,10 @@ these steps: | |||||||||||||||||||||||||||||||
| <var>inclusiveDescendant</var>'s <a for=Element>attribute list</a> to <var>document</var>. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <li><p>If <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a> | ||||||||||||||||||||||||||||||||
| <a>is a global custom element registry</a>, then set <var>inclusiveDescendant</var>'s | ||||||||||||||||||||||||||||||||
| <a for=Element>custom element registry</a> to <var>document</var>'s | ||||||||||||||||||||||||||||||||
| <a>effective global custom element registry</a>. | ||||||||||||||||||||||||||||||||
| is null or <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a>'s | ||||||||||||||||||||||||||||||||
| <a for=CustomElementRegistry>is scoped</a> is false, then set | ||||||||||||||||||||||||||||||||
| <var>inclusiveDescendant</var>'s <a for=Element>custom element registry</a> to | ||||||||||||||||||||||||||||||||
| <var>document</var>'s <a>effective global custom element registry</a>. | ||||||||||||||||||||||||||||||||
| </ol> | ||||||||||||||||||||||||||||||||
| </ol> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
|
|
@@ -6503,9 +6498,6 @@ It is initially set to false.</p> | |||||||||||||||||||||||||||||||
| <p><a for=/>Shadow roots</a> have an associated <dfn for=ShadowRoot>custom element registry</dfn> | ||||||||||||||||||||||||||||||||
| (null or a {{CustomElementRegistry}} object). It is initially null.</p> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <p><a for=/>Shadow roots</a> have an associated | ||||||||||||||||||||||||||||||||
| <dfn for=ShadowRoot>keep custom element registry null</dfn> (a boolean). It is initially false. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <p class=note>This can only ever be true in combination with declarative shadow roots. And it only | ||||||||||||||||||||||||||||||||
| matters for as long as the <a for=/>shadow root</a>'s <a for=ShadowRoot>custom element registry</a> | ||||||||||||||||||||||||||||||||
| is null. | ||||||||||||||||||||||||||||||||
|
|
@@ -11047,6 +11039,7 @@ James Graham, | |||||||||||||||||||||||||||||||
| James Greene, | ||||||||||||||||||||||||||||||||
| James M Snell, | ||||||||||||||||||||||||||||||||
| James Robinson, | ||||||||||||||||||||||||||||||||
| Jayson Chen, | ||||||||||||||||||||||||||||||||
| Jeffrey Yasskin, | ||||||||||||||||||||||||||||||||
| Jens Lindström, | ||||||||||||||||||||||||||||||||
| Jeremy Davis<!-- jeremydavis519; GitHub -->, | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.