W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2015

Re: oldNode.replaceWith(...collection) edge case

From: Glen Huang <curvedmark@gmail.com>
Date: Tue, 20 Jan 2015 21:22:05 +0800
Cc: WebApps WG <public-webapps@w3.org>
Message-Id: <A4DD250A-C9B1-46D1-BE47-471BB34D6CF2@gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
jQuery doesn’t support that out of performance and code size reasons: 

http://bugs.jquery.com/ticket/14380 <http://bugs.jquery.com/ticket/14380>
https://github.com/jquery/jquery/pull/1276#issuecomment-24526014 <https://github.com/jquery/jquery/pull/1276#issuecomment-24526014>

Both reasons shouldn’t be a problem with the native DOM.

> On Jan 20, 2015, at 6:39 PM, Anne van Kesteren <annevk@annevk.nl> wrote:
> 
> On Sun, Jan 18, 2015 at 4:40 AM, Glen Huang <curvedmark@gmail.com> wrote:
>> To generalize the use case, when you have a bunch of nodes, some of which need to be inserted before a node, and some of which after it, you are likely to want `replaceWith` could accept the context node as an argument.
> 
> This sound somewhat reasonable but I haven't been able to reproduce
> this in existing libraries. E.g. in Jquery
> 
>  $("div").replaceWith([$("div"), "<b>test</b>"])
> 
> ends up as just <b>test</b>...
> 
> 
> -- 
> https://annevankesteren.nl/
Received on Tuesday, 20 January 2015 13:22:39 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:25 UTC