jQuery HTML从XML

demo. see console

Lets assume scenes.xml is a list of sections

<sections>
  <section>
    <div...
  </section>
  ...
</sections>

and preload is a predefined hidden block. I'm loading this xml with $.ajax (of course with dataType: "xml") and trying to get html:

$(xmlData).find("section").each(function() {
  console.log(preload.empty().append(this).html())
})

It works perfect anywhere except ie 7-10. it throws:

 DOM Exception: HIERARCHY_REQUEST_ERR (3)
 in jquery.js (1.7.2) on line 6497

PS Of course I can wrap each section with CDATA and use text() to obtain html. But I want to avoid this workaround because each section is valid xml or html

extreme ugly workaround:

preload.empty()
if($.browser.msie) {
  if($.browser.version == "7.0" or $.browser.version == "8.0") {
    preload.append($(xmlData.xml).filter("section"))
  } else {
    preload.append($(xmlData.xml).find("section"))
  }
} else {
  preload.append($(xmlData).find("section"))
}
html = preload.html()
preload.empty().html(html)

Use $.parseXML if you're parsing XML.