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

Function indexOfNode

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

Source from the content-addressed store, hash-verified

614}
615
616function indexOfNode(node: Node) {
617 let index = 0;
618 let n: Node | null = node;
619
620 while ((n = n.previousSibling)) {
621 index++;
622 }
623 return index;
624}
625
626export function getSelection(container: Element): [Position, Position] | null {
627 let selection = window.getSelection();

Callers 1

getPositionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected