(Aside: I really should make a post about the first project that I’ve been working on… next time, haha)
classList.add() is really handy sans jQuery, though it doesn’t have very good support on IE. Cest le vie…
What I want to chat about today is
Element.querySelectorAll(). So apparently if you print out your selection
console.log(Element.querySelectorAll()) you get what looks like an array. Great, seems straight forward enough.
Array.isArray(Element) on your element returns
false. What? Well that explains why all solutions I’ve been looking up to traverse my ‘array’ has been coming up with some variation of the below to traverse the ‘array’:
Turns out that what document.querySelectorAll returns is actually a NodeList, and what
.call() to allow the NodeList to take advantage for the the array’s
This seems a bit messy, but I guess it’s the solution I have for now!
Until next time =)