comparePoint

The comparePoint JS Range returns −1 if the point is before the range, 0 if the point is in the range, and 1 if the point is after the range.

Syntax

position = range.comparePoint(node, offset)

Parameters

node

A node.

offset

A non-negative integer.

Examples

1 · p · before

2 · p · in

3 · p · after

4 · div · before

5 · div · in

6 · div · after

commonAncestorContainer

createContextualFragment

intersectsNode

Range

Web Hypertext Application Technology Working Group (WHATWG)

Home Menu