<story><title>You Don&apos;t Need JQuery</title><url>http://blog.garstasio.com/you-dont-need-jquery/</url></story><parent_chain><item><author>oneeyedpigeon</author><text>.classlist() [1] is coming [2]. It&amp;#x27;ll allow you to do:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    document.getElementById(&amp;#x27;foo&amp;#x27;).classList.remove(&amp;quot;bold&amp;quot;);
&lt;/code&gt;&lt;/pre&gt;
Sure, it&amp;#x27;s still more verbose. But a lot of what jQuery does is slowly being obsoleted by better native javascript apis.&lt;p&gt;[1] &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Element.classList&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;developer.mozilla.org&amp;#x2F;en-US&amp;#x2F;docs&amp;#x2F;Web&amp;#x2F;API&amp;#x2F;Element.cla...&lt;/a&gt;
[2] &lt;a href=&quot;http://caniuse.com/#feat=classlist&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;caniuse.com&amp;#x2F;#feat=classlist&lt;/a&gt;</text></item><item><author>bshimmin</author><text>You can basically sum up this entire rather ridiculous site with &amp;quot;Yes, you don&amp;#x27;t &lt;i&gt;need&lt;/i&gt; jQuery, you can just use the built-in methods, but using jQuery is generally more pleasant, more consistent, and involves less typing&amp;quot;.  One particularly egregious example from the site:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  $(&amp;#x27;#foo&amp;#x27;).removeClass(&amp;#x27;bold&amp;#x27;);
&lt;/code&gt;&lt;/pre&gt;
vs.&lt;p&gt;&lt;pre&gt;&lt;code&gt;  document.getElementById(&amp;#x27;foo&amp;#x27;).className = 
      document.getElementById(&amp;#x27;foo&amp;#x27;).className.replace(&amp;#x2F;^bold$&amp;#x2F;, &amp;#x27;&amp;#x27;);
&lt;/code&gt;&lt;/pre&gt;
The author summarises this, helpfully: &amp;quot;As usual, more characters, but still easy without jQuery.&amp;quot;&lt;p&gt;Of course, if you were doing that remove class operation quite often, rather than writing all that code out each time, you might wrap it up in a helper method, and maybe you&amp;#x27;d call it, I don&amp;#x27;t know, &amp;quot;removeClass&amp;quot; or something; perhaps if you were doing a whole bunch of DOM operations you might create little helper methods for each one, again to save you some typing.  Pretty quickly you might end up with a little library of helper methods... and, of course, being a wonderful programmer who never makes mistakes, I&amp;#x27;m sure that little library would be every bit as optimised, reliable, and correct as a battle-tested library used on hundreds of thousands of web sites.</text></item></parent_chain><comment><author>Khao</author><text>So when those new native api functions arrive, jQuery will start using them and gain some performance boost (using native vs. custom js code) while at the same time remaining backwards compatible (by doing feature detection). No one wants to write their own feature detection code so this whole page about using native apis is instead of jQuery is ridiculous.&lt;p&gt;If the point of that website was to educate people on the apis that jQuery calls under the hood, it chose a really poor name.</text></comment>
<story><title>You Don&apos;t Need JQuery</title><url>http://blog.garstasio.com/you-dont-need-jquery/</url></story><parent_chain><item><author>oneeyedpigeon</author><text>.classlist() [1] is coming [2]. It&amp;#x27;ll allow you to do:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    document.getElementById(&amp;#x27;foo&amp;#x27;).classList.remove(&amp;quot;bold&amp;quot;);
&lt;/code&gt;&lt;/pre&gt;
Sure, it&amp;#x27;s still more verbose. But a lot of what jQuery does is slowly being obsoleted by better native javascript apis.&lt;p&gt;[1] &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Element.classList&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;developer.mozilla.org&amp;#x2F;en-US&amp;#x2F;docs&amp;#x2F;Web&amp;#x2F;API&amp;#x2F;Element.cla...&lt;/a&gt;
[2] &lt;a href=&quot;http://caniuse.com/#feat=classlist&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;caniuse.com&amp;#x2F;#feat=classlist&lt;/a&gt;</text></item><item><author>bshimmin</author><text>You can basically sum up this entire rather ridiculous site with &amp;quot;Yes, you don&amp;#x27;t &lt;i&gt;need&lt;/i&gt; jQuery, you can just use the built-in methods, but using jQuery is generally more pleasant, more consistent, and involves less typing&amp;quot;.  One particularly egregious example from the site:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  $(&amp;#x27;#foo&amp;#x27;).removeClass(&amp;#x27;bold&amp;#x27;);
&lt;/code&gt;&lt;/pre&gt;
vs.&lt;p&gt;&lt;pre&gt;&lt;code&gt;  document.getElementById(&amp;#x27;foo&amp;#x27;).className = 
      document.getElementById(&amp;#x27;foo&amp;#x27;).className.replace(&amp;#x2F;^bold$&amp;#x2F;, &amp;#x27;&amp;#x27;);
&lt;/code&gt;&lt;/pre&gt;
The author summarises this, helpfully: &amp;quot;As usual, more characters, but still easy without jQuery.&amp;quot;&lt;p&gt;Of course, if you were doing that remove class operation quite often, rather than writing all that code out each time, you might wrap it up in a helper method, and maybe you&amp;#x27;d call it, I don&amp;#x27;t know, &amp;quot;removeClass&amp;quot; or something; perhaps if you were doing a whole bunch of DOM operations you might create little helper methods for each one, again to save you some typing.  Pretty quickly you might end up with a little library of helper methods... and, of course, being a wonderful programmer who never makes mistakes, I&amp;#x27;m sure that little library would be every bit as optimised, reliable, and correct as a battle-tested library used on hundreds of thousands of web sites.</text></item></parent_chain><comment><author>jhpriestley</author><text>`$(&amp;quot;.foo&amp;quot;).removeClass(&amp;quot;bold&amp;quot;)` becomes the wonderfully concise&lt;p&gt;&lt;pre&gt;&lt;code&gt;    [].map.call(document.querySelectorAll(&amp;quot;.foo&amp;quot;), function(node) { node.classlist.remove(&amp;quot;bold&amp;quot;); })&lt;/code&gt;&lt;/pre&gt;</text></comment>