The context does not include children of an elements siblings so it is necessary to record for each element that has been started but not yet ended whether any of its children matched the contextual matcher. This is done by using a bit set that is indexed by the current depth. Only the bit at the current depth affects whether an element is in context.
As the context only contains the following element it is necessary to check the contextual matcher on every element even within context.
|
|