mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
21 lines
439 B
JavaScript
21 lines
439 B
JavaScript
export function isChildOf(target, parentId) {
|
|
if (target.id) {
|
|
if (target.id == parentId) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
if (target.parentNode) {
|
|
if (target.parentNode.id) {
|
|
if (target.parentNode.id == parentId) {
|
|
return true;
|
|
} else {
|
|
return isChildOf(target.parentNode, parentId);
|
|
}
|
|
} else {
|
|
return isChildOf(target.parentNode, parentId);
|
|
}
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|