Find the closest parent that matches a selector