Fixes #13779. Remove nodes in document order (test)

Signed-off-by: Rick Waldron <waldron.rick@gmail.com>