We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent edae699 commit 1adaceeCopy full SHA for 1adacee
assets/web-components/infotip.js
@@ -36,6 +36,17 @@ class TatvaInfotip extends HTMLElement {
36
this.initEvents();
37
this.hideTooltip();
38
});
39
+
40
+ const slot = this.shadowRoot.querySelector('slot');
41
+ slot.addEventListener('slotchange', () => {
42
+ // gather all assigned nodes
43
+ const nodes = slot.assignedNodes({ flatten: true });
44
+ // check if there’s any non‑empty text left
45
+ const hasText = nodes.some(node =>
46
+ node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== ''
47
+ );
48
+ if (!hasText) this.remove();
49
+ });
50
}
51
52
// Renders the main template for the component
0 commit comments