MCPcopy Create free account
hub / github.com/adobe/react-spectrum / indexOfNode

Function indexOfNode

packages/react-aria/src/tokenfield/useTokenField.ts:597–605  ·  view source on GitHub ↗
(node: Node)

Source from the content-addressed store, hash-verified

595}
596
597function indexOfNode(node: Node) {
598 let index = 0;
599 let n: Node | null = node;
600
601 while ((n = n.previousSibling)) {
602 index++;
603 }
604 return index;
605}
606
607export function getSelection(container: Element): [Position, Position] | null {
608 let selection = window.getSelection();

Callers 1

getPositionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected