So I have an AJAX call which returns a complete XHTML document. In IE, when I get the XMLDocument from ajax.responseXML, all of the attributes on the body element are missing. Creating a new DOMParser and re-parsing ajax.responseText gives the same result. No problems in FF or Chrome.
Using the following workaround for now:
var x;
var body = xmldoc.getElementById('body');
if (!body) { //WTF?? IE loses the body's attributes 0.o
body = xmldoc.getElementsByTagName('body')[0];
var str = this.ajax.responseText;
var par = new DOMParser();
var tmpdoc;
var attr;
str = str.substr(str.indexOf('<body'));
str = str.substr(0, str.indexOf('>') + 1);
str += "</body>";
tmpdoc = par.parseFromString(str, "text/xml");
attr = tmpdoc.documentElement.attributes;
for (x = 0; x < attr.length; x++)
body.setAttribute(attr.item(x).name, attr.item(x).value);
}
This is super hacky though, anyone know a better way?