πŸ’™

jQuery

Fast, lightweight DOM manipulation library with cross-browser compatibility

Results Summary

Performance

93%
Lighthouse Score

Bundle Size

33.9KB
Gzipped

Build Time

1.5s
Average

Load Time

2.0s
LCP

Complexity

45
Cyclomatic

Performance Metrics

CLS
0.1459
FCP
1704ms
LCP
2040ms
TBT
6.5ms

Bundle Analysis

Compression
2.9x
File Count
1
JS %
99.5%
Total Size
97.7KB

Build Info

Build Time
1.5s
Output Size
2.3MB
HMR Time
110ms
Dev Startup
1.0s

About the jQuery Weather Front App

Status

  • Lint
  • Build
  • Test

Usage Instructions

First, follow the repo setup instructions.
Then cd into ./apps/jquery/ and and use the following commands:

  • Dev Command npm run dev
  • Test Command npm run test
  • Lint Command npm run lint
  • Build Command npm run build
  • Start npm start
For troubleshooting, use npm run verify from the root of the project.

App Requirements

The purpose of this project, was to build the same identical app in every frontend framework, in order to benchmark and compare their performance. As such, each app is built to meet identical requirements, which are then verified with the test suite.

Technical Requirements

  • Binding user input and validation
  • Fetching external data asynchronously
  • Basic state management of components
  • Handling fallback views (loading, errors)
  • Using browser features (location, storage, etc)
  • Logic blocks, for iterative content and conditionals
  • Lifecycle methods (mounting, updating, unmounting)

Feature Requirements

  • 🌦️ Live weather conditions
  • πŸ“… 7-day weather forecast
  • πŸ” City search functionality
  • πŸ“ Geolocation support
  • πŸ’Ύ Persistent location storage
  • πŸ“± Responsive design
  • β™Ώ Accessible interface
  • 🎨 Multi-theme support
  • πŸ§ͺ Fully unit tested
  • 🌐 Internationalized

jQuery Implementation

DOM-First Approach

jQuery follows a DOM-centric approach where you select elements first ($('#weather-container')) then manipulate them. The weather-ui.js demonstrates classic jQuery patterns.

Imperative DOM Manipulation

Unlike declarative frameworks, jQuery requires explicit DOM updates. When weather data changes, you manually call $('#temperature').text(temp) to update the display.

CSS Selector Power

jQuery's strength lies in its CSS selector engine. Complex DOM queries like $('.forecast-item.active .details') make it easy to find and manipulate specific elements.

Event Delegation

Uses jQuery's event delegation with .on() method to handle dynamically added forecast items, ensuring click handlers work on elements added after page load.

AJAX Integration

The weather service leverages jQuery's $.ajax() method for HTTP requests, providing a clean Promise-like interface with .done() and .fail() callbacks.

About jQuery

Real-world App

Coming soon...

Intro to jQuery

About jQuery

jQuery was once the king of the web, making DOM manipulation and AJAX simple back when browsers were inconsistent. Most of what it offers is now part of vanilla JS, so it’s largely unnecessary today. Still, it powered much of the modern web and is a big part of web history.

My thoughts on jQuery

Let's be honest - building a modern app with jQuery in 2024 feels like showing up to a Formula 1 race with a vintage car. It'll get you there, but everyone will wonder what the f*ck you are on. Still, jQuery powered the web for over a decade, and is still actually very widley used (thanks WordPress), so it's worth understanding what made it so dominant. Nowadays pertty much everything jQuery could do, is implemented into ES6+ natively, so there's little point in jQuery (unless u r supporting IE11).

The TL;DR of jQuery's magic was always in the simplicity. $('#weather-display').html(weatherHtml) just works. No virtual DOM, no component lifecycle, no build process - just select elements and manipulate them. The method chaining is genuinely elegant: $('.forecast-item').addClass('active').fadeIn(300) reads like English.

For our weather app, jQuery actually handles the basic functionality fine. Event delegation with $(document).on('click', '.forecast-toggle', handler) works perfectly, and $.ajax() fetches weather data without fuss. But you quickly realize you're manually managing everything React or Vue handles automatically - state updates, DOM synchronization, component organization.

The imperative style becomes tedious fast. Want to update the temperature display? Manually find the element and change its text. Need to show/hide loading states? Manually toggle CSS classes. It works, but you'll write 3x more code than you would in Svelte.

jQuery still has its place for simple enhancements to static sites, but for anything interactive, modern frameworks or even vanilla JS, are just better. The ecosystem and community have largely moved on, and you'll spend more time fighting against jQuery's limitations than building features.

Choosing a Framework

Stack Match Stack Match

Not sure if jQuery is right for your project? Use Stack Match to select your preferences and get a tailored recommendation based on the benchmark data.

Stack Match Screenshot