On this page

Skip to content

On jQuery

Introduction

Current .NET web architectures can generally be divided into the following two types:

  1. Using .NET framework's MVC or Razor Pages.
  2. Using frontend frameworks in conjunction with Web API.

For a backend-oriented web engineer, choosing the first option is usually the go-to for developing a website independently. As for learning frontend frameworks, just a quick Google search reveals the rapid pace of updates, along with various build tools and new technical jargon, which might make one want to give up before even starting (oops). Before the emergence of frontend frameworks, the mainstream frontend tool for the first approach was jQuery.

Analysis of jQuery's Pros and Cons

The advantages are as follows:

ProsDescriptionCurrent Status
Cross-browser syntax integrationIn the early days, JavaScript implementations varied across browsers, often requiring checks for browser versions to write different syntax. IE, in particular, had the largest gap compared to others. jQuery provided a series of APIs to handle these cross-browser implementation differences, significantly lowering the barrier to entry for JavaScript at the time.Today, all mainstream browsers implement standards according to W3C specifications. With IE retired, the impact of browser differences is becoming increasingly minimal.
Provides simple and rich APIs for DOM manipulationEarly APIs were quite limited; for example, to find a DOM element, one only had getElementById() and similar methods. jQuery provided Selector expressions to find DOM elements in various ways.Most of the APIs provided by jQuery have subsequently been incorporated into native browser APIs.
Rich ecosystem of pluginsDue to early browser compatibility issues and the scarcity of native APIs, many subsequent plugins were built to depend on jQuery.New plugins are starting to emerge that do not depend on jQuery, such as Bootstrap 5.

The disadvantages are as follows:

  1. jQuery 4 is nowhere in sight: Looking at the history of jQuery, you can see that after the release of version 3.4 in April 2019, subsequent updates have mostly focused on security, making it difficult to expect major functional enhancements in the future. However, as of version 3.6, it is still being maintained, so there should be no immediate concerns regarding security.

  2. Loose structure that is difficult to manage: jQuery is, after all, just a library, not a complete framework; the quality of the code depends heavily on the developer's skill.

From 2011 to 2022, there is no denying that jQuery held a very important position in past work. However, in recent years, as reliance on jQuery has decreased, I have been considering whether it is still necessary to continue using it.

Alternatives to jQuery

  1. Vue The mainstream frontend frameworks are React, Angular, and Vue. Among them, Vue is a progressive framework. Currently, it is the only one that can be used by simply referencing a JS file, allowing one to avoid the learning curve of frontend tools like webpack, and it can focus solely on UI presentation, making it easier to integrate with other libraries.

  2. ASP.NET Core Blazor Use C# instead of JavaScript to build rich, interactive UIs.

Conclusion

For current development, using Vue to replace jQuery is my choice, as switching directly to ASP.NET Core Blazor feels like too big a leap. However, Vue 3's shift to the Composition API has made me feel somewhat unadapted. After all, when frontend frameworks started to become popular, apart from studying Vue 2, I had already started to focus less on frontend advancement, and the Composition API feels like another world to me. To continue using .NET's Model Validation, I am currently choosing to develop websites using the older Vue 2 and VeeValidate 2. However, with the evolution of subsequent versions and coding styles, if I still cannot adapt to the new methods and cannot find a suitable Validate JS (the reason for not finding a replacement for VeeValidate 2 is more significant), I have started to consider shifting to ASP.NET Core Blazor.

Changelog

  • 2022-09-30 Initial document creation.