Files
DB-GPT/web/utils/dom.ts
aries_ckt bbf270699a Merge branch 'feature/support-neo4j' into feat/dbgpt_skill
# 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
2026-02-12 17:43:17 +08:00

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;
}