I have the css code below. In the code, I can successfully target and hide the children. But I want to hide the parent element if it has these classes in their children. This code only hides the children but the parent class is present. How can I hide the parent if it has these children?
.legend-row > .task-icon-AA, .task-AA,
.legend-row > .task-icon-BB, .task-BB,
.legend-row > .task-icon-CC, .task-CC {
display: none;
}