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 work in Chrome 43. Is this incorrect documentation or a browser bug?
The copied example code used on a page with checkboxes:
var list = document.querySelectorAll( 'input[type=checkbox]' );
for (var item of list) {
item.checked = true;
}
for..of
loops only support objects that are implemented as iterators, containing aSymbol.iterator
key/method. Currently, in Chrome,console.log(Symbol.iterator in list); // false
. – Hecklau