Daniel Glazman wrote: > > Using DOM1, I can't find a way to "cut" a Node from one > document and "paste" it into another one. All methods are > supposed to raise an exception if I try to do that. There is no way to do this in DOM Level 1. You have to create your own function : Node copyNode(Document dstDoc, Node n) { switch (n.nodeType) { case n.ELEMENT_NODE: newElement = doc.createElement(n.tagName); for (i = 0; i < n.attributes.length; i++) { newElement.setAttributeNode(importNode(n.attributes.item(i))); } for (i = 0; i < n.childNodes.length; i++) { newElement.appendChild(importNode(n.childNodes.item(i))); } return newElement; // and so on ... } } This function already exists in DOM Level 2: http://www.w3.org/TR/WD-DOM-Level-2/level-two-core.html#Level-2-Core-Node-importNode Regards, Philippe.Received on Tuesday, 24 August 1999 05:25:45 GMT
This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 October 2009 08:24:50 GMT