There is a general conversation around jQuery that it is a

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-08-12 06:30:02

There is a general conversation around jQuery that it is a "legacy" tool that has long since been replaced with ES6. This conversation seems to focus on features like document.querySelector() as "replacements" for what jQuery does. Many state that jQuery can be replaced by "four lines of utility code".

Unfortunately, these conversations appear to be poorly thought out. Most arguments ignore the two key features that make jQuery valuable:

The same coding style has been used for both and every attempt has been made to be idiomatic of the technology and latest standards.

Using jQuery resulting in 53% less Javascript and 36% smaller file size over ES6. The jQuery code achieves this through a much higher code density.

ES6 is a clear winner in total download size, where the loss in index.html is made up for by the need to download the jQuery library.

While it might be tempting to give ES6 the win due to the smaller download, it is important to understand that this is a micro-benchmark. In real world deployments, the amount of Javascript used on an interactive site will quickly overwhelm the 70KB required by jQuery. This is especially meaningful for multipage applications where the jQuery library will be cached once and then continuously reused across numerous page downloads. SPAs tend to prefer larger downloads up-front, making the size something of a non-issue for performance.

Leave a Comment