← Back to release summary

Iterable NodeList

Category
DOM
Type
New or changed feature
Status
Enabled by default (Chrome 51)
Intent stage
None

Summary

Add Symbol.iterator method to NodeList, as well as methods `keys()`, `values()`, `entries()` and `forEach()`. This will allow NodeList to be traversed via ES6 iteration statements: for (let node of document.querySelectorAll('.my-class') { ... } ... or via document.querySelectorAll('.my-class').forEach(node => { ... }

Standards & signals

Docs: https://dom.spec.whatwg.org/#interface-nodelist

View on chromestatus.com