capricorn86 / happy-dom

A JavaScript implementation of a web browser without its graphical user interface
MIT License
3.14k stars 189 forks source link

`DOMTokenList` should be iterable #1342

Closed silverwind closed 4 months ago

silverwind commented 4 months ago

Describe the bug DOMTokenList is currently not iterable in happy-dom while it is in jsdom, Firefox and Chrome.

The iterator should function exactly the same as DOMTokenList#values().

To Reproduce

const div = document.createElement("div");
div.classList.add("foo", "bar");
for (const cls of div.classList) console.log(cls);

Expected behavior Outputs foo\nbar\n.

Actual behaviour TypeError: div.classList is not iterable