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: Fri, 16 Jan 2015 21:58:10 +0800
Cc: WebApps WG <public-webapps@w3.org>
Message-Id: <1087AA51-E05B-4908-9551-E30A8D259D21@gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
Here is another try:

How about before executing the mutation method macro, we insert a transient node after `oldNode`, suppressing observers. Then run the mutation method macro, pre-insert `node` before the transient node and finally remove the transient node, suppressing observers.

Idea comes from Andrea’s DOM4 library: https://github.com/WebReflection/dom4/commit/ffc8cbdf88fa98627dd82cf11084a0660b9bbfc0 <https://github.com/WebReflection/dom4/commit/ffc8cbdf88fa98627dd82cf11084a0660b9bbfc0>

> On Jan 16, 2015, at 4:22 PM, Anne van Kesteren <annevk@annevk.nl> wrote:
> On Fri, Jan 16, 2015 at 8:47 AM, Glen Huang <curvedmark@gmail.com> wrote:
>> Another way to do this is that in mutation method macro, prevent `oldNode` from being added to the doc frag, and after that, insert the doc frag before `oldNode`, finally remove `oldNode`. No recursive finding of next sibling is needed this way.
> But then d2 would no longer be present?
> I don't really see a good reason to complicate the algorithm for this
> scenario, personally.
> -- 
> https://annevankesteren.nl/
Received on Friday, 16 January 2015 13:58:43 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:25 UTC