src/Range.php
/**
     * Returns a boolean indicating whether the given point is within the Range.
     *
     * @see https://dom.spec.whatwg.org/#dom-range-ispointinrange
     *
     * @throws \Rowbot\DOM\Exception\IndexSizeError
     * @throws \Rowbot\DOM\Exception\InvalidNodeTypeError
     */
Returns a boolean indicating whether the given point is within the Range.


Returns a boolean indicating whether the given point is within the Range .
public function isPointInRange(Node $node, int $offset): bool
    {
        $offset = Utils::unsignedLong($offset);
        $root = $this->startNode->getRootNode();
        if ($node->getRootNode() !== $root) {
            return false;
        }
        if ($node instanceof DocumentType) {
            throw new InvalidNodeTypeError();
        }
        if ($offset > $node->getLength()) {
            throw new IndexSizeError();
        }
        $bp = array($node, $offset);
        if (
            $this->computePosition($bp, [$this->startNode, $this->startOffset]) === 'before'
            || $this->computePosition($bp, [$this->endNode, $this->endOffset]) === 'after'
        ) {
            return false;
        }
        return true;
    }
public function isPointInRange ( Node $ node , int $ offset ) : bool { $ offset = Utils :: unsignedLong ( $ offset ) ; $ root = $ this -> startNode -> getRootNode ( ) ; if ( $ node -> getRootNode ( ) !== $ root ) { return false ; } if ( $ node instanceof DocumentType ) { throw new InvalidNodeTypeError ( ) ; } if ( $ offset > $ node -> getLength ( ) ) { throw new IndexSizeError ( ) ; } $ bp = array ( $ node , $ offset ) ; if ( $ this -> computePosition ( $ bp , [ $ this -> startNode , $ this -> startOffset ] ) === 'before' || $ this -> computePosition ( $ bp , [ $ this -> endNode , $ this -> endOffset ] ) === 'after' ) { return false ; } return true ; }
Returns a boolean indicating whether the given point is within the Range.
Returns a boolean indicating whether the given point is within the Range .