nodePosition method
O(1) lookup of the document-order position of nodeId.
Returns null if the node is not found in the document.
Implementation
int? nodePosition(String nodeId) {
if (_nodePositionIndexDirty) _rebuildNodeIndex();
return _nodePositionIndex[nodeId];
}