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 <ann...@annevk.nl> wrote: > > On Sun, Jan 18, 2015 at 4:40 AM, Glen Huang <curvedm...@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/