Helper for examining the Shadow DOM containment hierarchy.


deepContains(container, target) method

Returns true if the first node contains the second, even if the second node is in a shadow tree.

The standard Node.contains() function does not account for Shadow DOM, and returns false if the supplied target node is sitting inside a shadow tree within the container.

  • container: NodeThe container to search within.
  • target: NodeThe node that may be inside the container.

Returns: boolean - True if the container contains the target node.