-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Introduce customelementregistry global attribute #12000
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?
Conversation
|
@annevk Here's the PR for the new custom element registry attribute. |
| <code data-x="attr-customelementregistry">customelementregistry</code> attribute exists; | ||
| otherwise let <var>registry</var> be the result of | ||
| <span data-x="look up a custom element registry">looking up a custom element registry</span> | ||
| given <var>intendedParent</var>.</p></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need the same kind of complexity we need as for shadow roots for the same kind of scenario we discussed for them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if I followed here. Could you elaborate on the complexity we need for this attribute that you mentioned above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need a separate "keep custom element registry null" flag for whatwg/dom#1423 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added keep custom element registry null concept for the element attribute aligning with the shadowroot counterpart. Also updated whatwg/dom#1437 to include the concept.
|
This should probably have serialization steps similar to |
|
@Jamesernator @annevk
|
Sure, but calling This actually pretty similar to the |
|
I see what you mean. Then here's an open question on serialization if we expect the attribute to be serialized on element using scoped registry I want to verify here: In this case, initialize will give |
That depends how However if they didn't have a registry then yes I'd expect the change in registry would result in a change in serialization (just like any other DOM change). |
|
I believe the intended behavior of cusomelementregistry attribute is that the element with such attribute and the subtree of the element should all get null registry. The foo and bar in above example should get scoped registry, and it sounds like we do want the attribute serialized for foo and bar. What if we don’t do the initialize and left foo and bar’s registry null? Should they get the attribute during serialization as well in this case? |
Actually that makes sense, it seems fine to avoid serializing the attribute if the registry is the same as the parent element.
So I think the serialization is somewhat non-trivial, and we should also carefully consider the possibility of some kind of "declarative custom element registry" in future, with that in mind I think we should go along some lines of:
Ideally we should have some story for global registry as a child of a scoped registry (??? in the table), as both it's not clear how to serialize it, and people transitioning to scoped registries will likely come across places where they need to opt-out. As a bikeshed perhaps just: <div customelementregistry="">
<x-foo></x-foo>
<div customelementregisty="global">
<x-foo></x-foo>
</div>
</div>Now in the chart I've put !!! in front of entries that, while all could be omitted, may have impacts on a possible future declarative custom element registries. e.g. If in future we have something like: <customelementregistry specifier="named">
<define>....</define>
</customelementregistry>
<div customelementregistry="named">
<div customelementregistry=""></div>
</div>then those entries with !!! may need special consideration for how it would interact with such a possible feature. |
||||||||||||||||||||
Introduce
customelementregistryglobal attribute for elements as discussed in whatwg/dom#1413(See WHATWG Working Mode: Changes for more details.)
/custom-elements.html ( diff )
/dom.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/infrastructure.html ( diff )
/parsing.html ( diff )