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(tooltip): fix infinite loop in self-managed tooltips #4269

Merged
merged 7 commits into from
Apr 29, 2024
12 changes: 6 additions & 6 deletions packages/tooltip/src/Tooltip.ts
Expand Up @@ -209,8 +209,8 @@ export class Tooltip extends SpectrumElement {
// Resolve the parent element of the assigned slot (if one exists) or of the Tooltip.
let start: HTMLElement = this.assignedSlot || this;
let root = start.getRootNode();
if (window.__swc.DEBUG) {
if (root === document) {
if (root === document) {
if (window.__swc.DEBUG) {
window.__swc.warn(
this,
`Self managed <${this.localName}> elements walk up the composed tree to acquire a trigger element. No trigger element was found before the document.`,
Expand All @@ -219,8 +219,8 @@ export class Tooltip extends SpectrumElement {
level: 'high',
}
);
return root as HTMLElement;
}
return root as HTMLElement;
}
let triggerElement = (start.parentElement ||
(root as ShadowRoot).host ||
Expand All @@ -231,8 +231,8 @@ export class Tooltip extends SpectrumElement {
triggerElement.assignedSlot || (triggerElement as HTMLElement);
root = start.getRootNode();
/* c8 ignore next 13 */
if (window.__swc.DEBUG) {
if (root === document) {
if (root === document) {
if (window.__swc.DEBUG) {
window.__swc.warn(
this,
`Self managed <${this.localName}> elements walk up the composed tree to acquire a trigger element. No trigger element was found before the document.`,
Expand All @@ -241,8 +241,8 @@ export class Tooltip extends SpectrumElement {
level: 'high',
}
);
return root as HTMLElement;
}
return root as HTMLElement;
}
triggerElement = (start.parentElement ||
(root as ShadowRoot).host ||
Expand Down