first.configureParentToAllChilds();
}
private Collection<Selector> replaceFirstAppender(Selector selector, List<Selector> previousSelectors) {
if (selector.getHead().isAppender()) {
NestedSelectorAppender appender = (NestedSelectorAppender) selector.getHead();
return joinAll(previousSelectors, chopOffHead(selector), appender.getLeadingCombinator(), appender.isDirectlyBefore());
}
// appender somewhere in the middle
NestedSelectorAppender appender = selector.findFirstAppender();
if (appender == null)
throw new BugHappened("This is very weird error and should not happen.", selector);
Selector afterAppender = splitOn(selector, appender);
List<Selector> partialResults = joinAll(selector, previousSelectors, appender.getLeadingCombinator(), appender.isDirectlyAfter());
return joinAll(partialResults, afterAppender, null, appender.isDirectlyBefore());
}