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

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -