News for hackers. Stuff that matters.
Re:Why It's Time to Sunset jQuery by TazeTSchnitzel on Sunday April 14, 2013 @04:33PM (#5548159)
It's even better with modern JS:

    document.querySelectorAll(selector).forEach(function (elem) { value = somevalue; });
Which is more obvious in intent and more flexible.

Except this doesn't work, because that's not a real array, it's a stupid NodeList. :(

So you'd have to do:

  Array.prototype.slice.call(document.querySelectorAll('thing'), 0).forEach(function (elem) { value = somevalue; });
ugh.
Re:Why It's Time to Sunset jQuery by gildas on Sunday April 14, 2013 @04:49PM (#5548236)
You don't need to call the slice method:

    Array.prototype.forEach.call(document.querySelectorAll('thing'), function (elem) { value = somevalue; });
Re:Why It's Time to Sunset jQuery by TazeTSchnitzel on Sunday April 14, 2013 @05:32PM (#5548417)
And I could use underscore, a much more general-purpose library than jQuery to help me here, only 4kb. So:

  _.each(document.querySelectorAll('thing'), function (elem) { value = somevalue; });
(But then I might as well just use jQuery, I guess)
Re:Why It's Time to Sunset jQuery by Offler on Sunday April 14, 2013 @04:48PM (#5548229)
Everyone should be shimming ES5 array methods so your good example could quite happily run on older browsers too.