On Mon, Dec 7, 2020 at 1:11 AM Alexey Tikhonov <[email protected]>
wrote:

> Hello!
>
> I'm trying to make a script which would replace a selected node in the
> outline with the node's "shell copy". The new node should have the same
> header and body as the original one with all children cloned. After
> creating the new node the original position should be deleted - and that
> does not work. Could you, please, give me a hint where an error is?
>

My guess is that the culprit is:

shell_copy = p.insertBefore()

Oops. This invalidates position p!

Instead, the safe way is to create the new node *after* p. Now position p
remains valid.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS1eyprTAoHYzG9A1XXUUL8yFsfVXJ_w-W7jC84seKVW_Q%40mail.gmail.com.

Reply via email to