Earlier quoted context omitted.
> As one of the commenters pointed out, a lot of stuff was copied from jQuery to make it work. > In other words, this entire effort seems of dubious benefit to me. You made other points, but I wanted to focus on this one. Yes, there's a few remaining bits that don't have standards. But you can do so much with querySelector, classlist.toggle(), lastElementChild, scrollIntoView, insertAdjacentHTML - literally every Jav…
> Side benefit: also no weird $(thing)[0] when you need to use a DOM API, like HTML5 validity or whatever. But looping over querySelectorAll() is painful. I'm not really a frontend dev, so perhaps I'm doing it wrong, but this is the "easier" way I found when I was writing an app a few weeks ago (in TypeScript): // Get Array of HTMLElements from querySelectorAll(). let queryAll = (q: string): HTMLElement[] => { let no…
Not any more:
let elements = document.querySelectorAll('.some-class')
elements.forEach(function(element){
...
})
https://developer.mozilla.org/en-US/docs/Web/API/NodeList/fo...PS. The other two answers here are outdated.