• Determines if the child is a child of the parent in the DOM.

    Note that it returns false if the parent and child match. If you want to check if an element is a descendent or the same as a parent, use isElementSameOrChildOf.

    Parameters

    • child: null | Target

      Element, EventTarget, or CSS selector for child.

    • parent: null | Target

      Element, EventTarget, or CSS selector for parent.

    Returns boolean

    true if the child is a child of the specified parent.

    This function doesn't throw if the child and/or parent elements don't exist. Rather, it just returns false. This was a deliberate choice.