1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00
joplin/packages/utils/dom.ts

11 lines
380 B
TypeScript
Raw Normal View History

/* eslint-disable import/prefer-default-export */
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
export const findParentElementByClassName = (element: any, parentClassName: string) => {
while (element) {
if (element.classList.contains(parentClassName)) return element;
element = element.parentElement;
}
return null;
};