Skip to content

Commit

Permalink
Removed as, fixed types in isElementInToolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
supermar1010 committed Dec 19, 2024
1 parent 7d11d7f commit 586f1fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/heatmaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export class Heatmaps {
}

private _onMouseMove(e: Event): void {
if (isElementInToolbar(e.target as Element)) {
if (isElementInToolbar(e.target)) {
return
}
clearTimeout(this._mouseMoveTimeout)
Expand Down
9 changes: 6 additions & 3 deletions src/utils/element-utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { TOOLBAR_CONTAINER_CLASS, TOOLBAR_ID } from '../constants'

export function isElementInToolbar(el: Element | null): boolean {
// NOTE: .closest is not supported in IE11 hence the operator check
return el?.id === TOOLBAR_ID || !!el?.closest?.('.' + TOOLBAR_CONTAINER_CLASS)
export function isElementInToolbar(el: EventTarget | null): boolean {
if (el instanceof Element) {
// NOTE: .closest is not supported in IE11 hence the operator check
return el.id === TOOLBAR_ID || !!el.closest?.('.' + TOOLBAR_CONTAINER_CLASS)
}
return false
}

/*
Expand Down

0 comments on commit 586f1fd

Please sign in to comment.