[whatwg] Confusion about node1.replace(node2)

Currently the DOM spec defines a replace() method in the ChildNode interface. I find the name for that method a bit misleading.

When someone says A replace B, I get the impression that B is no longer in effect and A is the new one. So when I do `node1.replace(node2)`, I can’t help but feel node2 is replaced with node1, which is the opposite of what the spec specifies.

Do you think it would be worthwhile to change to a name that states the intention a bit clearer? Maybe something like `node1.replacedWith(node2)`?

Received on Saturday, 10 January 2015 08:16:56 UTC