Fix dev problem when hot reloading

- must check if element is still connected before manipulating element
This commit is contained in:
Mattias Granlund 2024-03-15 21:11:36 +01:00
parent 5d927abfcc
commit 8a83e01ce0

View File

@ -47,7 +47,7 @@ export function tooltip(node: HTMLElement, optsOrString: ToolTipOptions | string
}
function show() {
if (!text) return;
if (!text || !node.isConnected) return;
tooltip = document.createElement('div') as HTMLDivElement;
// TODO: Can we co-locate tooltip.js & tooltip.postcss?
tooltip.classList.add('tooltip', 'text-base-11'); // see tooltip.postcss