19 lines
549 B
TypeScript
19 lines
549 B
TypeScript
/*
|
|
* https://github.com/morethanwords/tweb
|
|
* Copyright (C) 2019-2021 Eduard Kuzmenko
|
|
* https://github.com/morethanwords/tweb/blob/master/LICENSE
|
|
*/
|
|
|
|
//export function findUpClassName<T>(el: any, className: string): T;
|
|
export default function findUpClassName(el: any, className: string): HTMLElement {
|
|
return el.closest('.' + className);
|
|
/* if(el.classList.contains(className)) return el; // 03.02.2020
|
|
|
|
while(el.parentElement) {
|
|
el = el.parentElement;
|
|
if(el.classList.contains(className))
|
|
return el;
|
|
}
|
|
return null; */
|
|
}
|