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

I wonder what the correct method should be? For the example I gave in the previous mail, it looks like I have to either create two fragments (and compute which nodes go to which fragment) and insert them before or after the node (two reflows), or implement the transient node algorithm myself (but with no suppressing observer ability, also three reflows (insert fake node, pull out context node, insert fragment), i guess if browsers implement it natively, they can reduce it to just one reflow?). Both doesn’t sound very optimal.

> On Jan 20, 2015, at 9:34 PM, Anne van Kesteren <annevk@annevk.nl> wrote:
> 
> On Tue, Jan 20, 2015 at 2:22 PM, Glen Huang <curvedmark@gmail.com> wrote:
>> jQuery doesn’t support that out of performance and code size reasons:
>> 
>> http://bugs.jquery.com/ticket/14380
>> https://github.com/jquery/jquery/pull/1276#issuecomment-24526014
>> 
>> Both reasons shouldn’t be a problem with the native DOM.
> 
> They are. I also realized that if we did this we would have to make
> before(), after(), and replaceWith() identical when passed the context
> object. Not allowing the context object and requiring usage of the
> correct method seems simpler.
> 
> 
> -- 
> https://annevankesteren.nl/

Received on Tuesday, 20 January 2015 14:01:17 UTC