1/* if you want to check deeply nested children*/
2const isDescendant = (el, parentId) => {
3 let isChild = false
4
5 if (el.id === parentId) { //is this the element itself?
6 isChild = true
7 }
8
9 while (el = el.parentNode) {
10 if (el.id == parentId) {
11 isChild = true
12 }
13 }
14 return isChild
15}