merging two doms

V

vissuyk

Hi,

What API exists to merge two in-memory dom trees? I saw importNode but
not sure if it handles the merge in all cases (e.g new child elements,
deleted child elements re-parenting etc).

Is importNode the right API ?. Is there any other api or code that
anyone can share ?.

Thanks a lot

Vissu
 
A

Alan Krueger

What API exists to merge two in-memory dom trees? I saw importNode but
not sure if it handles the merge in all cases (e.g new child elements,
deleted child elements re-parenting etc).

Is importNode the right API ?. Is there any other api or code that
anyone can share ?.

I believe DOM nodes can only be placed into the tree that owns them. If
I remember correctly, you'll need to use importNode to deep-copy a DOM
sub-tree into another tree if you want to merge.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top