Mozilla states that \"for of loops will loop over NodeList objects correctly\". (source: https://developer.mozilla.org/en-US/docs/Web/API/NodeList) However, this doesn\'t wo
Native Symbol.iterator
support for NodeList
was added to the WHATWG's DOM spec in 2014.
Unfortunately, Chrome 51 is the first version of Chrome to support it, and its Beta has only just been released at the time of writing this answer. Also, there's no support in any version of Internet Explorer or Edge.
To add Symbol.iterator
support for NodeList
in all browsers to your code, just use the following polyfill :
NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];