2023-07-27 07:31:52 +02:00
|
|
|
/*
|
2024-02-13 16:50:11 +01:00
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
2023-07-27 07:31:52 +02:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
export default (parent, child, checkSame = true) => {
|
|
|
|
if (checkSame && parent === child) return true;
|
2017-02-20 12:13:42 +01:00
|
|
|
let node = child.parentNode;
|
|
|
|
while (node) {
|
2022-05-07 07:19:15 +02:00
|
|
|
if (node === parent) return true;
|
2017-02-20 12:13:42 +01:00
|
|
|
node = node.parentNode;
|
|
|
|
}
|
|
|
|
return false;
|
2017-03-18 12:05:11 +01:00
|
|
|
};
|