The legacy parser strips some constructs from the wikitext early on in the parse; later stages of the parsing pipeline act as though they aren't present.
This cases subtle issues around (for example) HTML comments, which Parsoid preserves in the output of the page. "Leading" whitespace can actually be found either before *or* after an HTML-style comment in the wikitext, since the legacy parser stripped the comment before looking for the whitespace.
This is a general tracking bug. Specific tasks underneath this will address specific cases of this general behavior, so we can eventually remove these corner cases from the wikitext specification.