W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2015

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

From: Glen Huang <curvedmark@gmail.com>
Date: Mon, 12 Jan 2015 20:15:14 +0800
Message-Id: <24216E01-1AF7-421F-8195-879650CEAC54@gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
Cc: whatwg <whatwg@whatwg.org>
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 <annevk@annevk.nl> wrote:
> 
> On Mon, Jan 12, 2015 at 12:03 PM, Glen Huang <curvedmark@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.
> 
> 
> -- 
> https://annevankesteren.nl/
Received on Monday, 12 January 2015 13:09:11 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:32 UTC