5 ms·
Although I usually agree with the 'jQuery is overused' side of the crowd, I think your example is one of the times when I see that jQuery wins in ease and reada
by yrwwywtywsrty 7y ago
Although I usually agree with the 'jQuery is overused' side of the crowd, I think your example is one of the times when I see that jQuery wins in ease and readability.
The jQuery equivalent for this is $('.foo').addClass('bar');
- chrismorgan 7y agoI really dislike the way jQuery makes no distinction between mutations on one or many elements. I view the native APIs’ differentiation of the two, requring you to be explicit (`document.querySelector('.foo').classList.add('bar')` versus `document.querySelectorAll('.foo').forEach(foo => foo.classList.add('bar'))`) to be a feature.
- onion2k 7y agoMy version doesn't need a 30Kb library though.