Rewrite replace_all.
auto merge of #1222 : jdm/servo/remove_all, r=jdm