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

On Tue, 20 Jan 2015 15:00:41 +0100, Glen Huang <curvedmark@gmail.com>  
wrote:

> 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.

In all cases it would be just one reflow after the script has finished,  
unless you force a reflow by asking for layout information (e.g.  
offsetTop) between the mutations.

-- 
Simon Pieters
Opera Software

Received on Tuesday, 20 January 2015 15:57:32 UTC