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

Web Compatibility of Scoped Custom Element Registries #11076

Open
annevk opened this issue Feb 26, 2025 · 8 comments
Open

Web Compatibility of Scoped Custom Element Registries #11076

annevk opened this issue Feb 26, 2025 · 8 comments

Comments

@annevk
Copy link
Member

annevk commented Feb 26, 2025

What is the issue with the HTML Standard?

I stumbled across https://issues.chromium.org/issues/325035505 and the carmax.com issue reproduces in WebKit so unfortunately the new API design still has this problem. Quirking/outreach might be one solution, but maybe more such examples will come up?

cc @karlcow @rniwa @schenney-chromium

@rniwa
Copy link

rniwa commented Feb 26, 2025

Given this is an issue with Polymer's polyfill which is used on many production sites, I don't think we can quirk it. We should probably rename customElements to something else. Maybe customElementsRegistry.

@annevk
Copy link
Member Author

annevk commented Feb 27, 2025

Sigh. This is why we can't have nice things. I think we should drop the s with the new suffix, i.e., customElementRegistry. If we're going to solve this polyfill nonsense with a rename some more people should probably be in the loop.

cc @smaug---- @domenic @mfreed7 @justinfagnani

@annevk annevk added the agenda+ To be discussed at a triage meeting label Feb 27, 2025
@annevk
Copy link
Member Author

annevk commented Feb 27, 2025

@annevk
Copy link
Member Author

annevk commented Feb 27, 2025

We have prototyped a solution that seems to work and preserves the API pretty much as-is (still unfortunate though; please stop polyfilling and deploying polyfills):

  • Denote ShadowRoot's customElements with [Replaceable] in Web IDL
  • Change the type of ShadowRootInit's customElements member to any and ignore all non-CustomElementRegistry values.

@trusktr
Copy link

trusktr commented Feb 27, 2025

customElementRegistry

Just in case, if that doesn't work out and a rename has to be done, I'd say elementRegistry is nice. It is very obvious that new elements are "custom", so imo no need to keep the "custom" adjective.

@annevk annevk removed the agenda+ To be discussed at a triage meeting label Mar 3, 2025
@annevk
Copy link
Member Author

annevk commented Mar 3, 2025

I updated whatwg/dom#1341 to account for this. I'm happy with this resolution so removing agenda+.

@rniwa
Copy link

rniwa commented Mar 4, 2025

Hm... looks like there is another polyfill written by Google that's incompatible with enabling this version of the scoped custom element registries.

@rniwa
Copy link

rniwa commented Mar 5, 2025

We need to rename ShadowRoot.prototype.customElements after all because some versions of scoped custom element registries polyfill written by Google is incompatible with having this property. For now I'm renaming it to customElementRegistry in WebKit/WebKit#41910 but we can bikeshed the name.

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

No branches or pull requests

3 participants