No ticket: improve replaceWith testing
(cherry picked from commit 13468abaeb5488d547bc75d99bc3425ee891859e)
Fix #13233: re-allow .replaceWith of text nodes. Close gh-1137.
(cherry picked from commit 6b1b0a26b4d485b4d9f334286efed5dfe33e3f3f)