fix(slotmixin): now prints console error when shadowRoot is not found
This commit is contained in:
parent
def3df4c08
commit
08d13e1a30
2 changed files with 12 additions and 1 deletions
5
.changeset/stupid-hats-jam.md
Normal file
5
.changeset/stupid-hats-jam.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@lion/ui': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Now prints console error when shadowRoot is not found
|
||||||
|
|
@ -131,7 +131,13 @@ const SlotMixinImplementation = superclass =>
|
||||||
if (isFirstRender) {
|
if (isFirstRender) {
|
||||||
// @ts-expect-error wait for browser support
|
// @ts-expect-error wait for browser support
|
||||||
const supportsScopedRegistry = !!ShadowRoot.prototype.createElement;
|
const supportsScopedRegistry = !!ShadowRoot.prototype.createElement;
|
||||||
const registryRoot = supportsScopedRegistry ? this.shadowRoot || document : document;
|
const hasShadowRoot = Boolean(this.shadowRoot);
|
||||||
|
if (!hasShadowRoot) {
|
||||||
|
// TODO: throw an error in a breaking release
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(`[SlotMixin] No shadowRoot was found`);
|
||||||
|
}
|
||||||
|
const registryRoot = supportsScopedRegistry ? this.shadowRoot : document;
|
||||||
|
|
||||||
// @ts-expect-error wait for browser support
|
// @ts-expect-error wait for browser support
|
||||||
const renderTargetThatRespectsShadowRootScoping = registryRoot.createElement('div');
|
const renderTargetThatRespectsShadowRootScoping = registryRoot.createElement('div');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue