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

Add attribute to <template shadowroot> to disable upgrades #6

Open
justinfagnani opened this issue Jul 9, 2020 · 4 comments
Open

Comments

@justinfagnani
Copy link
Owner

In order to make scoped custom element registries and declarative shadow DOM work together we need a way to defer upgrading of elements in some shadow roots until their custom element registry has been set.

An attribute can tell the browser to either not upgrade the contained elements, or possibly to create an empty registry which would have the same effect.

<my-element>
  <template shadowroot scoped-custom-elements>
</my-element>

Then when the definition of my-element loads, it can set the registry, in conjunction with #3, to trigger upgrades.

This should be specified here, to make this proposal layer on top of declarative shadow DOM.

cc @mfreed7

@caridy
Copy link
Contributor

caridy commented Jul 9, 2020

This matches my mental model as well. Just like shadowroot attribute triggers the creation of a shadowRoot instance, the scope-custom-elements does the same, it creates a brand new (therefore, an empty registry that can be populated, or replaced once the component takes over).

Btw, we should bikeshed on the name of the scope-custom-elements attribute :), maybe just scoped.

@justinfagnani
Copy link
Owner Author

I worry that scoped is too general, since many things could be scoped and it might be read to apply to styling or something else.

And before the name even, I'd want to check that a boolean attribute is the way to go here, or whether there is some kind of enum we'd want to use. ie, if this attribute applies recursively, as would be expected from the registry lookup mechanism, a nested shadow root might want a way to opt out and use the global registry.

@LarsDenBakker
Copy link

I agree that scoped is too general. scoped-custom-elements should be fine.

@leobalter
Copy link
Collaborator

I'm more neutral to this change, I see pros and cons either way. In this manner I'd rather stick with the less conflicting name. So far, scoped-custom-elements should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants