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

2015-01-10 Thread Glen Huang
And since methods operate on the object they are invoked upon I think the name is clear enough. The fact replace() is a method operating on an object doesn’t clarify the intention in this case,because the confusion here is that it’s unclear whether the object is having others take its

[whatwg] Confusion about node1.replace(node2)

2015-01-10 Thread Glen Huang
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

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-14 Thread Glen Huang
Thank you for the quick fix. On Jan 14, 2015, at 5:37 PM, Anne van Kesteren ann...@annevk.nl wrote: On Mon, Jan 12, 2015 at 1:15 PM, Glen Huang curvedm...@gmail.com wrote: So yeah, replaceWith looks pretty good. Thanks: https://github.com/whatwg/dom/commit