3 ms·
This criticism makes no sense. If you always want an Array-like object, just always use querySelectorAll. If you don't then don't. Why is it bad that the DOM gi
by earthboundkid 7y ago
This criticism makes no sense. If you always want an Array-like object, just always use querySelectorAll. If you don't then don't. Why is it bad that the DOM gives you a choice instead of giving you a pseudo-array that sometimes acts like an element and sometimes not? The DOM more clearly separates NodeList from Element than JQuery, and that's good! I agree that not having forEach by default was a mistake, but it's long since been solved.
- dmitriid 7y ago> If you always want an Array-like object, just always use querySelectorAll `querySelectorAll` doesn’t even return an array-like object. It took w3c almost two years to add a forEach to it. It’s also so badly designed that MDN docs has a whole section oh how it behaves with unexpected results and how, quote “to restore expected behavior”. So all perceived benefits (like the separation between Element and NodeList) are badly contrived and trumped by how badly they are designed in comparison with a 15-year old library whose core API was designed by one person.