separate dom binding
This commit is contained in:
18
src/Util/isParentOf.js
Normal file
18
src/Util/isParentOf.js
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
/**
|
||||
* Check if `parent` is a parent of `child`.
|
||||
*
|
||||
* @param {Type} parent
|
||||
* @param {Type} child
|
||||
* @return {Boolean} Whether `parent` is a parent of `child`.
|
||||
*/
|
||||
export default function isParentOf (parent, child) {
|
||||
child = child._parent
|
||||
while (child !== null) {
|
||||
if (child === parent) {
|
||||
return true
|
||||
}
|
||||
child = child._parent
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user