xml parsing - Interaction between XMLDocument and JQuery .append() -


on 1 of .js files i've noticed weird interaction between 2 elements mention on title.

i'm first going provide sample code , after address issue in more detail.

var xmlclone = xmlcreatedocfromstring(this.xmltemplate); $(conf.current[currenttab]).find('#' + refid).after($(xmlclone).children()); 

where definition of xmlcreatedocfromstring is:

function xmlcreatedocfromstring(str) { var xmldoc;  if ( window.domparser ) {     var parser = new domparser();     xmldoc = parser.parsefromstring(str, "text/xml"); } else {     xmldoc = new activexobject("microsoft.xmldom");     xmldoc.async = false;     xmldoc.loadxml(str); }  return xmldoc; 

}

i'm testing on chrome pay attention "if" block in there.

the issue is, after first line in first code block, xmlclone have contents of this.xmltemplate, after using ".after()" jquery function (or .before, or .append) xmlclone becomes , empty xmldoc , screwing code.

so, need way append contents of xmlclone , keep them in xmlclone @ same time (aka appends js object).

if need additional information please ask , answer asap

jquery tends move objects rather copy them people looking do.

i sure there other ways, clone object before appending...

$(conf.current[currenttab]).find('#' + refid).after($(xmlclone).clone().children()); 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -