tweb-i2p/src/helpers/dom/isInDOM.ts
2021-08-03 04:30:06 +03:00

26 lines
738 B
TypeScript

/*
* https://github.com/morethanwords/tweb
* Copyright (C) 2019-2021 Eduard Kuzmenko
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*
* Originally from:
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
*/
/* export function isInDOM(element: Element, parentNode?: HTMLElement): boolean {
if(!element) {
return false;
}
parentNode = parentNode || document.body;
if(element === parentNode) {
return true;
}
return isInDOM(element.parentNode as HTMLElement, parentNode);
} */
export default function isInDOM(element: Element): boolean {
return element?.isConnected;
}