This is actually inside `valueForNode`; I checked, but we can't make it any more DRY by adding recursion.