mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
7 lines
247 B
TypeScript
7 lines
247 B
TypeScript
![]() |
export default function parents<T extends HTMLElement>(el: T, selector: string) {
|
||
|
const result = [];
|
||
|
for (let p = el && el.parentElement; p; p = p.parentElement) {
|
||
|
if (p.matches(selector)) result.push(p);
|
||
|
}
|
||
|
return result;
|
||
|
}
|