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

bug/issue 144 check CE registry before assuming a custom element definition exists #146

Conversation

thescientist13
Copy link
Member

Related Issue

resolves #144

greenwood-wcc-element-instance-no-shadow-root-working.mov

Summary of Changes

  1. Only use customElementsRegistry for checking if a custom element definition exists
  2. Refactor customElementsRegistry to be a set
  3. All tests still passing in Greenwood

See #145 for more on this topic

@thescientist13 thescientist13 added the bug Something isn't working label Feb 18, 2024
@thescientist13 thescientist13 changed the title Bug/issue 144 check registry before reusing a custom element definition bug/issue 144 check registry before reusing a custom element definition Feb 18, 2024
src/dom-shim.js Outdated
}

get(tagName) {
return this.customElementsRegistry[tagName];
if (this.customElementsRegistry.get(tagName)) {
Copy link
Member Author

@thescientist13 thescientist13 Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we use .has here instead?

if (this.customElementsRegistry.has(tagName)) {
  return this.customElementsRegistry.get(tagName);
} else {
  // ...
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, since CustomElementsRegistry does not expose a has method
https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry

@thescientist13 thescientist13 changed the title bug/issue 144 check registry before reusing a custom element definition bug/issue 144 check CE registry before assuming a custom element definition exists Feb 19, 2024
@thescientist13 thescientist13 force-pushed the bug/issue-144-check-registry-before-reusing-a-custom-element-definition branch from 1e3b651 to 057acf3 Compare March 9, 2024 19:08
@thescientist13 thescientist13 merged commit 13a3b72 into master Mar 9, 2024
12 checks passed
@thescientist13 thescientist13 deleted the bug/issue-144-check-registry-before-reusing-a-custom-element-definition branch March 9, 2024 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

registration of a custom element is being assumed when initializing a custom element
1 participant