Sometimes we put <wicket:child/> inside the body of a component tag. This when we must surround the body of the subclass (ie. between <wicket:extend>) with some component or attribute modifier.
In the interests of separation of concerns, we must allow the subclass to continue working as though there were no Component surrounding its body. We should not require the subclass to start worrying about the exact implementation of the super class.
We achieve this by making the component surrounding the subclass body transparent, allowing the subclass to use add() directly as per usual.
However, sometimes this causes problems. When rendering a component inside the transparent component surrounding the subclass body during an Ajax response, the markup for the component being rendered cannot be found, as described in
Also, fragments inside the <wicket:extend> of the subclass cannot be found for similar reasons, with no work around.
These problems arise from the implementation of Markup#find() and MarkupFragment#find(). Both, when they encounter a component tag, skip to the closing tag for the component tag. This is because we do not want to find grandchildren in the markup hierarchy, only direct children.
However, this is not always the correct behavior, because children can be top level component tags, as well as component tags which are direct children of <wicket:extend>, however deep in the hierarchy <wicket:extend> happens to be.
We should therefore change Markup#find() and MarkupFragment#find() to also find component tags which are the direct children of <wicket:extend>.