JSFiddle - React, Tailwind, and code Playground
JavaScript
/**
Demonstration of Jquery 1.9.0 problem running in IE:9/10
Both tests will run true in FireFox/Chrome/IE8 but test2 will fail in newer versions of IE
Problem lies in jquery method $.parseXML() returning document object instead of XMLDOMDocument when running in IE9/10
In those browsers a typemismatch error will be thrown from test2
*/
$(document).ready(function(xml,textStatus){
test1();
$.ajax({
data:{
xml:"<?xml version=\"1.0\" ?><root><child/></root>",
delay:1
},
url:"/echo/xml/",
type:"post",
dataType:"xml",
success:function(data,textStatus){test2(data);}
});
});
//test node insertion, both objects created from $.parseXML
function test1(){
var main_data = $($.parseXML("<root></root>")).find("root").eq(0);
var new_node = $($.parseXML("<test></test>")).find("test").eq(0).clone();
main_data.append(new_node);
alert("[test1] new node added: " + (($(main_data).find("test").length)?"true":"false") );
}
//test node insertion, one object created by $.parseXML, other by ajax return XML type
function test2(xml_data){
var main_data = $(xml_data).find("root");
var new_node = $($.parseXML("<test></test>")).find("test").eq(0).clone();
main_data.append(new_node);
alert("[test2] new node added: " + (($(main_data).find("test").length)?"true":"false") );
}