export async function describeTextPosition()

in packages/dom/src/text-position/describe.ts [61:75]


export async function describeTextPosition(
  range: Range,
  scope?: Node | Range,
): Promise<TextPositionSelector> {
  scope = toRange(scope ?? ownerDocument(range));

  const textChunks = new TextNodeChunker(scope);
  if (textChunks.currentChunk === null)
    throw new RangeError('Scope does not contain any Text nodes.');

  return await abstractDescribeTextPosition(
    textChunks.rangeToChunkRange(range),
    textChunks,
  );
}