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

2015-01-12 Thread Anne van Kesteren
On Sat, Jan 10, 2015 at 2:14 PM, James M. Greene james.m.gre...@gmail.com wrote: jQuery is famous (and sometimes infamous, depending on who you talk to) for its API brevity and yet we still chose longer names for these scenarios: `replaceWith` and `replaceAll` (even including All in the latter

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

2015-01-12 Thread Glen Huang
Just realize that reversing the algorithm won’t work for node.replace(nodes), where nodes contains multiple nodes. So yeah, replaceWith looks pretty good. On Jan 12, 2015, at 8:07 PM, Anne van Kesteren ann...@annevk.nl wrote: On Mon, Jan 12, 2015 at 12:03 PM, Glen Huang curvedm...@gmail.com

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

2015-01-12 Thread Glen Huang
Or, the current algorithm of replace could be reversed, which should eliminate such confusion. On Jan 12, 2015, at 6:41 PM, Anne van Kesteren ann...@annevk.nl wrote: On Sat, Jan 10, 2015 at 2:14 PM, James M. Greene james.m.gre...@gmail.com wrote: jQuery is famous (and sometimes infamous,

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

2015-01-12 Thread delfin
On 2015-01-11 03:58, Bjoern Hoehrmann wrote: * 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

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

2015-01-12 Thread Anne van Kesteren
On Mon, Jan 12, 2015 at 12:03 PM, Glen Huang curvedm...@gmail.com wrote: Or, the current algorithm of replace could be reversed, which should eliminate such confusion. I think as James said that would leave the confusion. And given the precedent in libraries, replaceWith() seems good. --

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

2015-01-12 Thread Brian Kardell
On Mon, Jan 12, 2015 at 7:15 AM, Glen Huang curvedm...@gmail.com wrote: Just realize that reversing the algorithm won’t work for node.replace(nodes), where nodes contains multiple nodes. So yeah, replaceWith looks pretty good. On Jan 12, 2015, at 8:07 PM, Anne van Kesteren ann...@annevk.nl