When we say “descendant” that means the element should be either child, grandchild or basically be part of the boundary of the target element.
Element contains() Method Syntax:
Element contains() Method Parameter
The method takes one argument and that is a reference to an element that we want to see if the element that invoked this method is part of the string of ancestors for that reference element or not.
Element contains() Method Return Value
The method returns a value of type boolean.
The value true means the target element has the argument of the method (the reference element) as part of its children (either direct or indirect). The value false means otherwise.
Here, even though the <li> item was the grandchild of the <body> element, calling the `contains()` method on the body element returned the value true.