How do I move a Node from one document to another?
Answer:
Neither Level 1 nor Level 2 allow you to move a Node from one document to another, although Level 2 has an importNode method which allows you to copy a Node from one document to another. So, using Level 2, you copy the Node from the source to the target document and then delete the Node from the source document. If you want to do this in Level 1, you will need to write your own function that creates a new Node in the target document and then copies the data.
DOM Level 3 has adoptNode() that will let you move a Node from one Document to another.
No comments:
Post a Comment