1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-16 12:05:26 +02:00
Files
misskey/packages/frontend/src/scripts/contains.ts
2024-02-12 11:37:45 +09:00

15 lines
336 B
TypeScript

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export default (parent, child, checkSame = true) => {
if (checkSame && parent === child) return true;
let node = child.parentNode;
while (node) {
if (node === parent) return true;
node = node.parentNode;
}
return false;
};