containsNode

fun containsNode(node: Node, allowPartialContainment: Boolean = definedExternally): Boolean(source)

The Selection.containsNode() method indicates whether a specified node is part of the selection.

MDN Reference