function contains(container, contained) {
    // According to the jQuery API, an element does not "contain" itself
    if (contained === container) {
        return false;
    }
    /*
     * Step up the descendants, stopping when the root element is reached
     * (signaled by `.parent` returning a reference to the same object)
     */
    let next = contained;
    while (next && next !== next.parent) {
        next = next.parent;
        if (next === container) {
            return true;
        }
    }
    return false;
}
/**
 * Checks to see if the `contained` DOM element is a descendant of the
 * `container` DOM element.
 *
 * @param container - Potential parent node.
 * @param contained - Potential child node.
 * @returns Indicates if the nodes contain one another.
 * @alias Cheerio.contains
 * @see {@link https://api.jquery.com/jQuery.contains/}
 */
Checks to see if the `contained` DOM element is a descendant of the
`container` DOM element.

@param container - Potential parent node.
@param contained - Potential child node.
@returns Indicates if the nodes contain one another.
Checks to see if the ` contained ` DOM element is a descendant of the ` container ` DOM element . @param container - Potential parent node . @param contained - Potential child node . @returns Indicates if the nodes contain one another .
function contains(container, contained) {
    if (contained === container) {
        return false;
    }
    let next = contained;
    while (next && next !== next.parent) {
        next = next.parent;
        if (next === container) {
            return true;
        }
    }
    return false;
}
function contains ( container , contained ) { if ( contained === container ) { return false ; } let next = contained ; while ( next && next !== next . parent ) { next = next . parent ; if ( next === container ) { return true ; } } return false ; }
Checks to see if the `contained` DOM element is a descendant of the
 `container` DOM element.
Checks to see if the ` contained ` DOM element is a descendant of the ` container ` DOM element .
// According to the jQuery API, an element does not "contain" itself /*
     * Step up the descendants, stopping when the root element is reached
     * (signaled by `.parent` returning a reference to the same object)
     */