javascript - for of loop querySelectorAll -
mozilla states "for of loops loop on nodelist objects correctly". (source: https://developer.mozilla.org/en-us/docs/web/api/nodelist) however, doesn't work in chrome 43. incorrect documentation or browser bug?
the copied example code used on page checkboxes:
var list = document.queryselectorall( 'input[type=checkbox]' ); (var item of list) { item.checked = true; }
edit: this shipping in chrome 51.
jake archibald posted simple fix:
nodelist.prototype[symbol.iterator] = array.prototype[symbol.iterator]
and of loops.
Comments
Post a Comment