new DOMParser parseFromString data text html var total getElementById

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
f = new DOMParser().parseFromString(data, "text/html");
var total = f.getElementById('container').childNodes.length;
for( var i=0; i<total; i++){
var sitem = f.getElementById('container').children[i].firstChild.querySelector('div.inner-article > h1').firstChild.text;
var scolor = f.getElementById('container').children[i].firstChild.querySelector('div.inner-article > p').firstChild.text;
if((sitem.indexOf(item)+1)&&(scolor == color)){
var link = "http://www.supremenewyork.com" + f.getElementById('container').children[i].firstChild.querySelector('div.inner-article > p').firstChild.getAttribute('href');
}
}