Do you see any problems with the following:
NodeList.prototype.forEach = Array.prototype.forEach;
Normally forEach
is just a property of arrays, but by setting it as a property of all NodeList
s as well, there's no need to convert a NodeList
to an array before you can loop through its nodes with forEach
.