Files
NapCatQQ/.pnpm-store/v3/files/7d/7dbd5ea981d2d2ffad630a1adb08552f1daf2fdc20613424e1464d3171572414996446953b1813c59cd21015a704f3d92ac24500c66938f04be540653eb9a5
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

21 lines
467 B
Plaintext

/**
* Recursively traverse up the tree to check whether the provided child node
* is the parent or a descendant of it.
*
* @param parent - Element to find
* @param child - Element to test against parent
*/
const isNodeOrChild = (parent, child) => {
if (!child) {
return false;
}
else if (parent === child) {
return true;
}
else {
return isNodeOrChild(parent, child.parentElement);
}
};
export { isNodeOrChild };