In order to simplify the code and make it more readable.
In order to reduce code duplication and make the code more legible.
Requesting checkin. A corresponding try run has only failures unrelated to this change.
Pushed by firstname.lastname@example.org:
factor out functionality to determine fixup node in nsDocumentEncoder. r=hsivonen