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

fix(slotmixin): Now throws shadowRoot not found in case of shadowRoot… #2291

Merged
merged 5 commits into from
May 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/ui/components/core/src/SlotMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ const SlotMixinImplementation = superclass =>
if (isFirstRender) {
// @ts-expect-error wait for browser support
const supportsScopedRegistry = !!ShadowRoot.prototype.createElement;
const registryRoot = supportsScopedRegistry ? this.shadowRoot || document : document;
const hasShadowRoot = Boolean(this.shadowRoot);
if (!hasShadowRoot) {
throw new Error(`No shadowRoot was found`);
Dozom marked this conversation as resolved.
Show resolved Hide resolved
}
const registryRoot = supportsScopedRegistry ? this.shadowRoot : document;

// @ts-expect-error wait for browser support
const renderTargetThatRespectsShadowRootScoping = registryRoot.createElement('div');
Expand Down