Skip to content

Commit b484bc4

Browse files
authored
Merge pull request #3 from svelte-plugins/listener
fix(handler): add conditional check for containerRef before unbinding
2 parents d930f29 + fda85e3 commit b484bc4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@svelte-plugins/tooltips",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"license": "MIT",
55
"description": "A simple tooltip action and component designed for Svelte.",
66
"author": "Kieran Boyle (https://github.com/dysfunc)",

src/tooltip.svelte

+4-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@
8080
component = null;
8181
}
8282
83-
containerRef.removeEventListener('mouseenter', onMouseEnter);
84-
containerRef.removeEventListener('mouseleave', onMouseLeave);
83+
if (containerRef !== null) {
84+
containerRef.removeEventListener('mouseenter', onMouseEnter);
85+
containerRef.removeEventListener('mouseleave', onMouseLeave);
86+
}
8587
});
8688
8789
$: isComponent = typeof content === 'object';

0 commit comments

Comments
 (0)