From cb86a8c9a6f049491e043e0ad3d889c4341ee3e0 Mon Sep 17 00:00:00 2001 From: Xiaoji Chen Date: Wed, 4 Dec 2024 21:21:01 -0800 Subject: [PATCH] Fix infinite loop (#8) Co-authored-by: Felix Palmer --- examples/vite.config.local.js | 2 +- src/hammerjs/utils/has-parent.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/vite.config.local.js b/examples/vite.config.local.js index 4be5afa..6f2c12b 100644 --- a/examples/vite.config.local.js +++ b/examples/vite.config.local.js @@ -1,5 +1,5 @@ import {defineConfig} from 'vite'; -import {getOcularConfig} from 'ocular-dev-tools'; +import {getOcularConfig} from '@vis.gl/dev-tools'; import {join} from 'path'; import {fileURLToPath} from 'url'; diff --git a/src/hammerjs/utils/has-parent.ts b/src/hammerjs/utils/has-parent.ts index 189ca6a..1490e16 100644 --- a/src/hammerjs/utils/has-parent.ts +++ b/src/hammerjs/utils/has-parent.ts @@ -2,12 +2,12 @@ * find if a node is in the given parent */ export default function hasParent(node: HTMLElement, parent: HTMLElement): boolean { - let ancester: Node | null = node; - while (ancester) { - if (ancester === parent) { + let ancestor: Node | null = node; + while (ancestor) { + if (ancestor === parent) { return true; } - ancester = node.parentNode; + ancestor = ancestor.parentNode; } return false; }