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

[scoped-custom-element-registry] The scoped registry doesn't work if the DOM already contains the web component when it is defined. #540

Open
jpzwarte opened this issue Mar 9, 2023 · 0 comments

Comments

@jpzwarte
Copy link

jpzwarte commented Mar 9, 2023

class Foo extends ScopedElementsMixin(LitElement) {
  static get scopedElements() {
    return { 'x-bar': Bar };
  }
}
  1. Load the polyfill
  2. Have <x-foo> in the DOM
  3. Call customElements.define('x-foo', Foo);
  4. window.customElements.get('x-bar') === Bar

Step 3 should be false, but is true.

If I remove <x-foo> from the DOM, then step 3 is false.

Also this only seems to happen with a production (rollup) build, not with a dev build :/ (specifically storybook build using vite build vs storybook dev)

Atm I only have time to report this and not create a reproduction :/

@jpzwarte jpzwarte changed the title [scoped-custom-element-registry] The scoped registry doesn't work in the DOM already contains the web component when it is defined. [scoped-custom-element-registry] The scoped registry doesn't work if the DOM already contains the web component when it is defined. Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant