Is there any built in function in JavaScript to get only element nodes, or do I have to add another loop which counts the actual number of those if I need it before, like:
l = 0;
for(i = 0; i < x.childNodes.length; i++){
if(x.childNodes[i].nodeType = 1) l++;
}
for(i = 0; i < x.childNodes.length; i++){
if(x.childNodes[i].nodeType != 1) continue;
new Something(l);
}
.childreninstead of.childNodes