This is consistent with all the other places where we use the id attribute: If it does not exist, use the index instead.