I want to copy/clone 2 xml dom objects - one into another.
Sorry if it is duplicate question... I've already tried What is the most efficient way to deep clone an object in JavaScript?
But jquery throws Illegal invocation
EDIT: XML comes from an ajax call
function FetchXMLData() {
$.ajax({
url : "resources/data.xml",
data : requestVars,
dataType : 'xml',
success : function(xml) {
XMLParser(xml);
xmlOrig = $(xml).clone(); // I want to do something like this
},
error : function(xhr, err) {
ShowErrors(xhr, err);
}
});
}
EDIT 2: Now, I'm using javascript cloneNode, that works perfectly in IE and FF, but fails in Chrome. See this. If anyone knows a workaround I would be grateful.