That's because parent.children is a NodeList, and it doesn't support the .forEach method (as NodeList is an array like structure but not an array), so try to call it by first converting it to array using
var children = [].slice.call(parent.children);
children.forEach(yourFunc);