Checks if the target is the same or a child element of the parent.
target
parent
Element, EventTarget, or CSS selector.
Element, EventTarget, or CSS selector for parent (or same) element.
true if the child is a child of or the same as the specified parent.
true
child
This function doesn't throw if the specified child and/or parent elements don't exist. Rather, it just returns false. This was a deliberate choice.
false
Checks if the
target
is the same or a child element of theparent
.