Added NearestAncestorOfType.