Use vanilla Javascript instead of jQuery
Introduction
We should use vanilla JavaScript rather than jQuery.
Decision
When possible, use vanilla JavaScript instead of jQuery on projects. This allows us to gain higher performance and less overhead by not having to load the jQuery library.
Context
Drupal and WordPress are moving away from jQuery. Plain JavaScript is preferable due to its better performance and modern features. The advancement of JavaScript has diminished the value of numerous advantages previously associated with jQuery, such as cross-browser compatibility and simplified code writing.
Consequences
- The potential for an increase in development time due to the inability to rely on predefined jQuery functions.
Exceptions
- Legacy code: If a project is already using jQuery, it might be beneficial to continue using it for the sake of consistency.
Additional Resources
None