Re: [whatwg] Confusion about node1.replace(node2)

Bjoern Hoehrmann <derhoermi@gmx.net> writes:

> * Glen Huang wrote:
>>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.
>
> To illustrate this, imagine some team sports game where the coach jells
> "Jane, replace John!", in other words, `Jane.replace(John)`. It is clear
> that Jane is instructed to take the position of John.

To elaborate on this a bit: “Jane.replace(John)” takes Jane as the first
(implicit) argument and John as the second (explicit), so I read it like
“replace Jane and John”. This may look ambiguous – until you remember
who is instructed to to the replacement, namely Jane.

-- 
Nils Dagsson Moskopp // erlehmann
<http://dieweltistgarnichtso.net>

Received on Tuesday, 10 February 2015 04:46:04 UTC