mirror of
https://github.com/csunny/DB-GPT.git
synced 2026-07-17 18:28:42 +00:00
# Conflicts: # packages/dbgpt-ext/src/dbgpt_ext/storage/knowledge_graph/community/neo4j_store_adapter.py # uv.lock # web/locales/en/common.ts # web/locales/zh/common.ts # web/package-lock.json # web/yarn.lock
16 lines
446 B
TypeScript
16 lines
446 B
TypeScript
/**
|
|
* Find the closest parent element with a specific class name.
|
|
*/
|
|
export function findParentElementByClassName(element: Element | null, className: string): Element | null {
|
|
if (!element) return null;
|
|
|
|
let currentElement: Element | null = element;
|
|
while (currentElement) {
|
|
if (currentElement.classList.contains(className)) {
|
|
return currentElement;
|
|
}
|
|
currentElement = currentElement.parentElement;
|
|
}
|
|
return null;
|
|
}
|