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 22:00:41 +0800
Cc: WebApps WG <public-webapps@w3.org>
Message-Id: <BD10A173-6362-418C-9DBA-6EE6AF5837C3@gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
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

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