src/Range.php
/**
     * Returns a boolean indicating whether or not the given Node intersects the
     * Range.
     *
     * @see https://dom.spec.whatwg.org/#dom-range-intersectsnode
     */
Returns a boolean indicating whether or not the given Node intersects the
Range.


Returns a boolean indicating whether or not the given Node intersects the Range .
public function intersectsNode(Node $node): bool
    {
        $root = $this->startNode->getRootNode();
        if ($node->getRootNode() !== $root) {
            return false;
        }
        $parent = $node->parentNode;
        if (!$parent) {
            return true;
        }
        $offset = $node->getTreeIndex();
        $position1 = $this->computePosition([$parent, $offset], [$this->endNode, $this->endOffset]);
        $position2 = $this->computePosition(
            [$parent, $offset + 1],
            [$this->startNode, $this->startOffset]
        );
        return $position1 === 'before' && $position2 === 'after';
    }
public function intersectsNode ( Node $ node ) : bool { $ root = $ this -> startNode -> getRootNode ( ) ; if ( $ node -> getRootNode ( ) !== $ root ) { return false ; } $ parent = $ node -> parentNode ; if ( ! $ parent ) { return true ; } $ offset = $ node -> getTreeIndex ( ) ; $ position1 = $ this -> computePosition ( [ $ parent , $ offset ] , [ $ this -> endNode , $ this -> endOffset ] ) ; $ position2 = $ this -> computePosition ( [ $ parent , $ offset + 1 ] , [ $ this -> startNode , $ this -> startOffset ] ) ; return $ position1 === 'before' && $ position2 === 'after' ; }
Returns a boolean indicating whether or not the given Node intersects the
 Range.
Returns a boolean indicating whether or not the given Node intersects the Range .