webcomponents / webcomponents/polyfills

[scoped-custom-element-registry] Pulling in from multiple components on a page results in "Illegal constructor (custom element class..." error.

Open
#615 4 comments 2 reactions 0 assignees View on GitHub
Focus Area: Standards & Polyfills Type: Bug
Dominant language
HTML
Stars
1.2k
Forks
168
PR merge metrics
No merged PRs in 30d

Description

### Description
We are in an environment where scoped-custom-element-registry is being pulled in multiple times on a page (from the page itself and at least one component of the page). This was supported in 0.0.9. After upgrading to 0.0.10, we are now getting the error "Illegal constructor (custom element class..." and the page breaks.

### Example

### Steps to reproduce
Import scope-custom-element-registry from multiple places on a single page.

#### Expected behavior
Import is conditional, and essentially ignored if the component is already imported.

#### Actual behavior
The following error is thrown:

"Illegal constructor (custom element class must be registered with global customElements registry to be newable)"

### Version

@webcomponents/scoped-custom-element-registry@0.0.10

### Browsers affected

- [X] Chrome
- [X] Firefox
- [X] Edge
- [X] Safari
- [ ] IE 11

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.