JSFiddle - React, Tailwind, and code Playground
JavaScript
//Taken form: https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Whitespace_in_the_DOM
function is_ignorable( nod )
{
return ( nod.nodeType == 8) || // A comment node
( (nod.nodeType == 3) && is_all_ws(nod) ); // a text node, all ws
}
function is_all_ws( nod )
{
// Use ECMA-262 Edition 3 String and RegExp features
return !(/[^\t\n\r ]/.test(nod.data));
}
$.ajax({
type: "POST",
url: "/echo/xml/",
dataType: "xml",
data: {
xml: '<portfolio>\
<year id="2014">\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
</year>\
<year id="2013">\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
</year>\
<year id="2012">\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
</year>\
<year id="2011">\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
<image thumbnail="" href="" desc=""></image>\
</year>\
</portfolio>'
},
success: function(xml) {
var x = xml.getElementsByTagName("portfolio")[0].childNodes,
y, i, j,...