jsTree xml_data插件不适用于11.它适用于所有浏览器(包括ie10),但不适用于ie11。没有错误信息,只能永远“加载”。
$("#hierarquia").jstree({
"xml_data" : {"ajax" : {"url" : "XML.asp"}},
"plugins" : ["xml_data"]
});
有人经历过这个吗?到目前为止,我在网上找不到任何关于jsTree和ie11的引用。
感谢您的帮助!
答案 0 :(得分:8)
在jstree.js文件中有这个函数:
(function ($) {
$.vakata.xslt = function (xml, xsl, callback) {
var rs = "", xm, xs, processor, support;
// TODO: IE9 no XSLTProcessor, no document.recalc
if (window.ActiveXObject) {
var xslt = new ActiveXObject("Msxml2.XSLTemplate");
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
xmlDoc.loadXML(xml);
xslDoc.loadXML(xsl);
xslt.stylesheet = xslDoc;
var xslProc = xslt.createProcessor();
xslProc.input = xmlDoc;
xslProc.transform();
callback.call(null, xslProc.output);
return true;
}
if(typeof window.DOMParser !== "undefined" && typeof window.XMLHttpRequest !== "undefined" && typeof window.XSLTProcessor === "undefined") {
xml = new DOMParser().parseFromString(xml, "text/xml");
xsl = new DOMParser().parseFromString(xsl, "text/xml");
// alert(xml.transformNode());
// callback.call(null, new XMLSerializer().serializeToString(rs));
}
if(typeof window.DOMParser !== "undefined" && typeof window.XMLHttpRequest !== "undefined" && typeof window.XSLTProcessor !== "undefined") {
processor = new XSLTProcessor();
support = $.isFunction(processor.transformDocument) ? (typeof window.XMLSerializer !== "undefined") : true;
if(!support) { return false; }
xml = new DOMParser().parseFromString(xml, "text/xml");
xsl = new DOMParser().parseFromString(xsl, "text/xml");
if($.isFunction(processor.transformDocument)) {
rs = document.implementation.createDocument("", "", null);
processor.transformDocument(xml, xsl, rs, null);
callback.call(null, new XMLSerializer().serializeToString(rs));
return true;
}
else {
processor.importStylesheet(xsl);
rs = processor.transformToFragment(xml, document);
callback.call(null, $("<div />").append(rs).html());
return true;
}
}
return false;
};
if
if (window.ActiveXObject)
您需要添加以下内容:
if (window.ActiveXObject || "ActiveXObject")
希望有意义
编辑:
将if语句更改为以下内容,因为之前的修补程序导致Chrome出现问题:
if (window.ActiveXObject !== undefined || "ActiveXObject" in window)