This article is homage to jQuery – a library that once was a great boost for the productivity of thousands of web developers around the world. In the near future, the benefit of using it will drop as web developers start switching to the web standards, including Web Components.
jQuery has become the library of choice for the past seven years by providing three major advantages:
- Extensive plugin ecosystem – currently facing the possibility of being replaced with Web Components
Levels the differences between web browsers
In the times when Internet Explorer 6 ruled 90% of users’ desktops, the web developers were in desperate need of maintaining code that worked both in Internet Explorer and web standards-compliant browsers, such as Mozilla Firefox, Opera and early versions of Google Chrome.
jQuery since day one aimed at providing a consistent API that behaved the same way in all the browsers, handling each browser’s quirks internally. This was a huge relief for the developer, who no longer needed to care about implementation details of a particular browser. It led to a significant reduction of testing and bug fixing.
What once was a great a major selling point of jQuery has become no longer significant; hence jQuery 2.0, released April 2013, dropped support for IE6-8 which resulted in 15% file size reduction and admittedly the loss of one if its original purposes.
A simple, easy to learn API
Other websites cover this in higher detail, but I will name just a few that mostly used jQuery methods that now have a native implementation in browsers:
$function that finds elements in DOM using CSS selectors is being replaced with standard
removeClassmethods are being replaced with standard
mapmethods for array traversing are being replaced with standard
animatemethod, mostly used to move the elements on screen, is being replaced with more powerful and efficient CSS transitions
Using the native implementation of the above features means better performance and interoperability, so it is recommended over jQuery where possible.
Extensive plugin ecosystem
One can’t argue that jQuery provides currently an unbeatable collection of plugins that implement behavior and UI elements used in websites and web applications. The official jQuery Plugin Registry holds more than 2,000 plugins, which is likely not even 10% of all jQuery plugins circulating around the web.
A jQuery plugin can be inserted to any website given that:
- The web developer loads the jQuery and the plugin file in the HTML <head>.
- All plugins on a page need to use the same version of jQuery; otherwise it gets very tedious (though not impossible) to integrate them.
Web Components share some of the above steps but in a simpler way:
- The web developer loads the shim library (such as Polymer) and the HTML import in the HTML
- All Web Components on a page need to use the same version of the shim library. Given that the shim library implements agreed standards, it is more likely that upgrading the library will not break the existing code.
With a background in jQuery development, I have an appreciation for its contributions to web development. However, as with any technology, jQuery is quickly becoming outdated as new innovations replace or improve its elements and methods. Web Components include upcoming standards for web development, and can offer developers a simpler and more efficient way to code. To learn more about Web Components, click here: Introduction to Web Components.