dom/node: fix order of replaceChild in #replace