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 <ann...@annevk.nl> wrote:
> 
> On Fri, Jan 16, 2015 at 8:47 AM, Glen Huang <curvedm...@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/

Reply via email to