Describe the bug
Element.classList has empty string item when a class attribute contains multiple spaces. Multiple spaces should be compressed and Element.classList should not have empty string item.
To Reproduce
Steps to reproduce the behavior:
- Run following code:
const {Window} = require('happy-dom');
const {document} = new Window();
const element = document.createElement('div');
element.className = 'a b';
const list = [...element.classList.values()];
console.log(list); // ['a', '', 'b']
Expected behavior
The expected result of list is ['a', 'b']. Other DOM implenetations including Google Chrome, Mozilla Firefox, and JSDOM return ['a', 'b'].
Device:
- OS: Windows 11
- Browser: Google Chrome and Mozilla Fireefox
- Version; happy-dom 12.10.3
Describe the bug
Element.classList has empty string item when a class attribute contains multiple spaces. Multiple spaces should be compressed and Element.classList should not have empty string item.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The expected result of
listis['a', 'b']. Other DOM implenetations including Google Chrome, Mozilla Firefox, and JSDOM return['a', 'b'].Device: