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

Function indexOfNode

packages/@react-spectrum/ai/src/TokenField.tsx:565–573  ·  view source on GitHub ↗
(node: Node)

Source from the content-addressed store, hash-verified

563});
564
565function indexOfNode(node: Node) {
566 let index = 0;
567 let n: Node | null = node;
568
569 while ((n = n.previousSibling)) {
570 index++;
571 }
572 return index;
573}
574
575export function getSelection(container: Element): [Position, Position] | null {
576 let selection = window.getSelection();

Callers 1

getPositionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected