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

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

From: Simon Pieters <simonp@opera.com>
Date: Tue, 20 Jan 2015 16:57:01 +0100
To: "Anne van Kesteren" <annevk@annevk.nl>, "Glen Huang" <curvedmark@gmail.com>
Cc: "WebApps WG" <public-webapps@w3.org>
Message-ID: <op.xsrqlbboidj3kv@simons-mbp>
On Tue, 20 Jan 2015 15:00:41 +0100, Glen Huang <curvedmark@gmail.com>  

> 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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:14:43 UTC