pub const MAX_NTH_OF_DEPTH: usize = 8;Expand description
The maximum An+B of S nesting depth accepted.
XPath 1.0 has no variables, so S must be written out more than once:
to filter the siblings being tested — twice when a test bounds the
sibling count from both sides, as :nth-child(2 of S) or
:nth-child(2n+3 of S) does — and once more to constrain the element
being matched. An of S list nested inside another therefore appears
in every copy, and the output doubles or triples per level — a
~500-byte selector nesting 30 deep asks for far more memory than
exists. The duplication is inherent, so only a depth limit can bound
it, with MAX_NTH_OF_BYTES behind it for the arguments the depth
alone does not keep small. Nothing hand-written nests of S at all.
This is far below MAX_NESTING_DEPTH, which bounds
recursion rather than output size and so can afford to be generous.