• Checks if the target is the same or a child element of the parent.

    Parameters

    • child: null | Target

      Element, EventTarget, or CSS selector.

    • parent: null | Target

      Element, EventTarget, or CSS selector for parent (or same) element.

    Returns boolean

    true if the child is a child of or the same as the specified parent.

    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.