In some cases, Parsoid's mw-empty-elt tagging of empty p-tags runs too soon. This seems to show up a lot on frwiki pages. Look at Legacy vs Parosid There is an extra newline in the Parsoid output. If you inspect the relevant HTML, you will see that on the legacy side, you have the "mw-empty-elt" class added to the empty p-tag but not in Parsoid.
Turns out this is because Parsoid's 'handleEmptyElt' and 'finalCleanup' handlers run in the same DOM pass which runs as an in-order traversal. So, the handleEmptyElt runs on a p-tag before finalCleanup deletes elements in a p-tag making it empty. Even if you reorder the handlers, it doesn't work because of the in-order traversal. The p-tag is processed (and detected not-empty) before the finalCleanup processes the p-tag's children.
So, two solutions:
(a) Introduce post-order traversal for some DOM passes -- needs careful thinking how this works in the face of mutations
(b) Split finalCleanup and handleEmptyElt into two passes so the ordering works out
This is a source of a lot of minor whitespace diffs and visual diffing noise on frwiki pages (and not sure which other wikis)