We use jQuery among other things here:
- Navigation menus – now in Vanilla JS
- Scroll-to-top button – now in Vanilla JS
- Header Search dropdown – now in Vanilla JS
- Post Sliders
- Tabbed Content Widget
- Infinite Scroll in the Toolkit Plugin
- Theme Options in the Customizer
But what advantages does Vanilla JS have now? There are two main things:
- Better performance
No need to include the huge jQuery library saves valuable KiloBytes on every page load.
- No dependencies and conflicts
Our scripts don’t have to wait if and until jQuery is fully loaded.
Any third-party script ultimately increases the risk of conflicts with other WordPress plugins.
With the latest updates, we’ve now removed jQuery from all navigation menus, Scroll-to-top buttons, and Header Search dropdowns and replaced it with Vanilla JS. In total, we’ve customized several dozen scripts. For the Post Sliders, Tabbed Content widget and Infinite Scroll we are still looking for solutions. However, if you are not using these features, you can now run our WordPress themes without jQuery.
For the theme options in the Customizer it is not worth it to implement them without jQuery. Here, the library is already loaded by WordPress Core and also the performance plays less of a role in the WordPress backend, because normal website visitors do not have access to it.