jQuery 4.0.0 BETA!

Posted on by

jQuery 4.0.0 has been in the works for a long time, but it is now ready for a beta release! There’s a lot to cover, and the team is excited to see it released. We’ve got bug fixes, performance improvements, and some breaking changes. We removed support for IE<11 after all! Still, we expect disruption to be minimal.

Many of the breaking changes are ones the team has wanted to make for years, but couldn’t in a patch or minor release. We’ve trimmed legacy code, removed some previously-deprecated APIs, removed some internal-only parameters to public functions that were never documented, and dropped support for some “magic” behaviors that were overly complicated.

We will publish a comprehensive upgrade guide before final release, to outline the removed code and how to migrate. The jQuery Migrate plugin will also be ready to assist. For now, please try out the beta release and let us know if you encounter any issues.

As usual, the release is available on our CDN and the npm package manager. Third party CDNs will not be hosting this beta release, but will host the 4.0.0 final release later. Here are some highlights for jQuery 4.0.0 beta.

Goodbye IE<11

jQuery 4.0 drops support for IE 10 and older. Some may be asking why we didn’t remove support for IE 11. We plan to remove support in stages, and the next step will be released in jQuery 5.0. For now, we’ll start by removing code specifically supporting IE versions older than 11, giving us a size reduction of -867 gzipped bytes in one PR!

We also dropped support for other very old browsers, including Edge Legacy, iOS <11, Firefox <65, and Android Browser. No changes should be required on your end. If you need to support any of these browsers, simply stick with jQuery 3.x.

Deprecated APIs removed

These functions have been deprecated for several versions. It’s time to remove them now that we’ve reached a major release. These functions were either always meant to be internal or ones that now have native equivalents in all supported browsers. The removed functions are:

push, sort, and splice removed

The jQuery prototype has long had Array methods that did not behave like any other jQuery methods and were always meant for internal-use only. These methods are push, sort, and splice. We switched our uses of these methods to Array functions instead of the jQuery prototype. For example, $elems.push( elem ) became [].push.call( $elems, elem ). We’re mentioning it here in case there are any plugins out there that may have relied on these methods.

focusin and focosout event order

For a long time, browsers did not agree on the order of focus and blur events, which includes focusin, focusout, focus, and blur. Finally, the latest versions of all browsers that jQuery 4.0 supports have converged on a common event order. Unfortunately, it differs from the consistent order that jQuery had chosen years ago, which makes this a breaking change. At least everyone is the on the same page now!

jQuery’s order for all four events in previous versions was:

1. focusout
2. blur
3. focusin
4. focus

Starting with jQuery 4.0, we no longer override native behavior. This means that all browsers except IE will follow the current W3C specification, which is:

1. blur
2. focusout
3. focus
4. focusin

For those that are curious, the W3C specification previously defined a different order:

1. focusout
2. focusin
3. blur
4. focus

But, few thought that intuitive and the spec was changed in 2023 to match what browsers have already implemented. Ironically, the only browser to ever follow the old spec was Internet Explorer.

FormData support

jQuery.ajax has added support for binary data, including FormData. Previously, binary data was not a known data type and was converted to a string. That behavior could be disabled by disabling data conversion and handling the data manually, but we decided to make this work automatically. This is technically a breaking change, but should be closer to expected behavior.

Automatic JSONP promotion removed

Previously, jQuery.ajax with dataType: "json" with a provided callback would be converted to a JSONP request. Today, the preferred way to interact with a cross-domain backend is with CORS, which works in all browsers that jQuery 4.0 supports. This should help avoid unexpected behavior in case a developer is unaware that code can be executed from a remote domain with JSONP.

jQuery source migrated to ES modules

It was a special day when the jQuery source on the main branch was migrated from AMD to ES modules. The jQuery source has always been published with jQuery releases on npm and GitHub, but could not be imported directly as modules without RequireJS, which was jQuery’s build tool of choice. We have since switched to Rollup for packaging jQuery and we do run all tests on the ES modules separately.

Trusted Types and CSP

jQuery 4.0 adds support for Trusted Types, ensuring that HTML wrapped in TrustedHTML can be used as input to jQuery manipulation methods in a way that doesn’t violate the require-trusted-types-for Content Security Policy directive.

Along with this, while some AJAX requests were already using <script> tags to maintain attributes such as crossdomain, we have since switched most asynchronous script requests to use <script> tags to avoid any CSP errors caused by using inline scripts. There are still a few cases where XHR is used for asynchronous script requests, such as when the "headers" option is passed (use scriptAttrs instead!), but we now use a <script> tag whenever possible.

Updated slim build

The slim build has gotten even smaller in jQuery 4.0.0 with the removal of Deferreds and Callbacks (now below 20k bytes gzipped!). Deferreds have long-supported the Promises A+ standard, so native Promises can be used instead in most cases and they are available in all of jQuery’s supported browsers except IE11. Deferreds do have some extra features that native Promises do not support, but most usage can be migrated to Promise methods. If you need to support IE11, it’s best to use the main build or add a polyfill for native Promises.

Download

You can get the files from the jQuery CDN, or link to them directly:

https://code.jquery.com/jquery-4.0.0-beta.js

https://code.jquery.com/jquery-4.0.0-beta.min.js

You can also get this release from npm:

npm install jquery@4.0.0-beta

Slim build

Sometimes you don’t need ajax, or you prefer to use one of the many standalone libraries that focus on ajax requests. And often it is simpler to use a combination of CSS and class manipulation for web animations. Finally, all of jQuery’s supported browsers (except for IE11) now have support for native Promises across the board, so Deferreds and Callbacks are no longer needed in most cases. Along with the regular version of jQuery that includes everything, we’ve released a “slim” version that excludes these modules. The size of jQuery is very rarely a load performance concern these days, but the slim build is about 8k gzipped bytes smaller than the regular version. These files are also available in the npm package and on the CDN:

https://code.jquery.com/jquery-4.0.0-beta.slim.js

https://code.jquery.com/jquery-4.0.0-beta.slim.min.js

These updates are already available as the current versions on npm and Bower. Information on all the ways to get jQuery is available at https://jquery.com/download/. Public CDNs receive their copies today, please give them a few days to post the files. If you’re anxious to get a quick start, use the files on our CDN until they have a chance to update.

Thanks

Thank you to all of you who participated in this release by submitting patches, reporting bugs, or testing, including Alex, Ahmed S. El-Afifi, fecore1, Dallas Fraser, Richard Gibson, Michał Gołębiowski-Owczarek, Pierre Grimaud, Gabriela Gutierrez, Jonathan, Necmettin Karakaya, Anders Kaseorg, Wonseop Kim, Simon Legner, Shashanka Nataraj, Pat O’Callaghan, Christian Oliff, Dimitri Papadopoulos Orfanos, Wonhyoung Park, Bruno PIERRE, Baoshuo Ren, Beatriz Rezener, Sean Robinson, Ed Sanders, Timo Tijhof, Tom, Christian Wenz, ygj6 and the whole jQuery team.

We’re on Mastodon!

jQuery now has its very own Mastodon account. We will be cross posting to both Twitter and Mastodon from now on. Also, you may be interested in following some of our team members that have Mastodon accounts.

jQuery: https://social.lfx.dev/@jquery

mgol: https://hachyderm.io/@mgol

timmywil: https://hachyderm.io/@timmywil

Changelog

Full changelog: 4.0.0-beta

    Ajax

    • Don’t treat array data as binary (992a1911)
    • Allow `processData: true` even for binary data (ce264e07)
    • Support binary data (including FormData) (a7ed9a7b)
    • Support `headers` for script transport even when cross-domain (#5142, 6d136443)
    • Support `null` as success functions in `jQuery.get` (#4989, 74978b7e)
    • Don’t auto-execute scripts unless dataType provided (#4822, 025da4dd)
    • Make responseJSON work for erroneous same-domain JSONP requests (68b4ec59)
    • Execute JSONP error script responses (#4771, a1e619b0)
    • Avoid CSP errors in the script transport for async requests (#3969, 07a8e4a1)
    • Drop the json to jsonp auto-promotion logic (#1799, #3376, e7b3bc48)
    • Overwrite s.contentType with content-type header value, if any (#4119, 7fb90a6b)
    • Deprecate AJAX event aliases, inline event/alias into deprecated (23d53928)
    • Do not execute scripts for unsuccessful HTTP responses (#4250, 50871a5a)
    • Simplify jQuery.ajaxSettings.xhr (#1967, abdc89ac)

    Attributes

    • Shave off a couple of bytes (b40a4807)
    • Don’t stringify attributes in the setter (#4948, 4250b628)
    • Drop the `toggleClass(boolean|undefined)` signature (#3388, a4421101)
    • Refactor val(): don’t strip carriage return, isolate IE workarounds (ff281991)
    • Don’t set the type attr hook at all outside of IE (9e66fe9a)

    build

    • set up periodic code scanning analysis (39c5778c)

    Build

    • migrate grunt authors to a custom script (af79c999)
    • Bump follow-redirects from 1.15.1 to 1.15.4 (56139394)
    • Bump actions/setup-node and github/codeql-action (99151d7a)
    • Reformat GitHub workflow Yaml files (c98597ea)
    • Bump @babel/traverse & multiple actions (fb0cc272)
    • Don’t run CI push workflows for dependabot branches (635cb152)
    • Update ESLint-related packages, fix linting errors (f47c6a83)
    • Run pretest before test:* npm scripts (1ad66aeb)
    • sort branches in compare_size; last run last (a7fa303f)
    • run pretest in jenkins script (cb763072)
    • fix inconsistent builds in Node 20 (7ef9099d)
    • add commit SHAs and last runs to comparisons (09972bcc)
    • add new factory files to dist eslint (79223841)
    • Bump qs, socket.io-parser, socket.io & json5 (b923047d)
    • migrate most grunt tasks off of grunt (2bdecf8b)
    • Bump actions/checkout, actions/setup-node & github/codeql-action (42e50f8c)
    • Update mailmap entry for Krinkle (699bcd39)
    • replace CRLF with LF during minify (48cc402a)
    • Add `exports` to package.json, export slim & esm builds (#4592, 8be4c0e4)
    • Switch form Terser to SWC for JS minification (#5286) (#5285, e2421875)
    • Make sure `*.cjs` & `*.mjs` files use UNIX line endings as well (198b41c8)
    • switch preferred email for timmywil (2b6b5e0a)
    • Bump github/codeql-action & actions/checkout (4a13266e)
    • Drop individual AMD modules (5701957b)
    • Reference GitHub Actions by commit SHAs (#5266, 784b9ba6)
    • Switch the minifier from UglifyJS to Terser (27303c6b)
    • Make the `eslint:dev` task not lint the `dist/` folder (44906a83)
    • Test on Node.js 20, stop testing on Node.js 14 & 19 (6616acff)
    • Only install Playwright dependencies when needed (e77bd9d6)
    • Bump actions/setup-node from 3.5.1 to 3.6.0 (7e7bd062)
    • Run GitHub Action browser tests on Playwright WebKit (b02a257f)
    • Migrate middleware-mockserver to modern JS (ce90a484)
    • remove stale Insight package from custom builds (c66d4700)
    • Limit permissions for GitHub workflows (c909d6b1)
    • Test on Node.js 18 & 19, stop testing on Node 12 (f62d8e21)
    • Bump actions/setup-node from 3.5.0 to 3.5.1 (0208224b)
    • Update Grunt from 1.4.1 to 1.5.3 (aa231cd2)
    • Bump actions/setup-node from 3.4.1 to 3.5.0 (25400750)
    • Update GitHub Actions (52f452b2)
    • Add dependabot.yml config (GitHub Actions) (3f8bb2a4)
    • Test on Node 17, update Grunt & `karma-*` packages (2525cffc)
    • Separate the install step from running tests in GitHub Actions (eef97250)
    • remove travis.yml and travis mentions from core (#4983) (5f4d449a)
    • Migrate CI to GitHub Actions (e23190e6)
    • Update ESLint & eslint-plugin-import, fixing the build (9735edd5)
    • Test on Node.js 16 instead of 15 (0f623fdc)
    • Take core-js-bundle from the external directory as well (345cd22e)
    • Restore the external directory (a684e6ba)
    • Rename master to main across the repository (8ae477a4)
    • Test on Node.js 15 (6984d174)
    • Explicitly exclude the queue module from the slim build (a503c691)
    • Make the import/no-unused-modules ESLint rule work in WebStorm (8612018d)
    • Append .eslintignore paths to grunt eslint paths (a22b43ba)
    • Use the US spelling of “favor” (fa0058af)
    • Fix commitplease husky config (#4735, 3a1b338a)
    • Update dependencies (b5028669)
    • Event: Make sure all source modules’ exports are used (#4648) (40c3abd0)
    • Update eslint-config-jquery, fix linting violations (ef4d6ca6)
    • Followups after introducing ES modules compiled via Rollup (55cd3a44)
    • Correct code indentations based on jQuery Style Guide (3d62d570)
    • Reduce the slim build header comment & jQuery.fn.jquery (812b4a1a)
    • Move ESLint max-len disable-directive to dist/.eslintrc.json (34296ec5)
    • Test on Node.js 14, stop testing on Node.js 8 & 13 (88eb22e0)
    • Enable reportUnusedDisableDirectives in ESLint (46f9810b)
    • Resolve Travis config warnings (5b94a4f8)
    • Enable ESLint one-var rule for var declarations in browser code (4a7fc854)
    • Add Christian Oliff to .mailmap & AUTHORS.txt (721744a9)
    • Lint the minified jQuery file as well – a Gruntfile fix (#3075, 338f1fc7)
    • Lint the minified jQuery file as well (#3075, 89a18de6)
    • Add intuitive names to Travis jobs (e1fab109)
    • Make dev mode work in Karma again, serve source files from disk (437f389a)
    • Tests: Fix custom build tests, verify on Travis (0f780ba7)
    • Create a `grunt custom:slim` alias for the Slim build (#4578) (9b9ed469)
    • Make Karma work in ES modules mode (341c6d1b)
    • Auto-convert sources to AMD (f37c2e51)
    • Fix the Windows build (#4548, 9fd2fa53)
    • Require extensions for ES6 imports, prevent import cycles (44ac8c85)
    • Fix the import path to serialize.js from ajax.js (07532014)
    • Run tests on Travis only on browsers defined in the config (bcbcdd2b)
    • Run tests on Firefox ESR as well (2d5ad6d2)
    • Run tests on Node.js 13 in addition to 8, 10 & 12 (830976e6)
    • Run tests on Travis on FirefoxHeadless as well (584835e6)
    • Require strict mode in Node.js scripts via ESLint (bbad821c)
    • Support jquery-release –dry-run flag (d7d0b52b)
    • Stop copying src/core.js to dist on release (#4489, 9a4d9806)
    • Remove the external directory, read from node_modules directly (d7e64190)
    • ESLint: forbid unused function parameters (438b1a3e)
    • Fix the regex parsing AMD var-modules (#4389) (9ec09c3b)
    • Fix AMD dependencies in curCSS (b220f6df)
    • Test on Node.js 12, stop testing on Node.js 6 & 11 (b8d47128)
    • Fix unresolved jQuery reference in finalPropName (#4358, 87403058)
    • Update Sizzle from 2.3.3 to 2.3.4 (#1756, #4170, #4249, 0b2c36ad)
    • Update the master version to 4.0.0-pre (c4f2fa2f)
    • Update Sinon from 2.3.7 to 7.3.1, other updates (fea7a2a3)

    Core

    • Add more info about named exports (5f869590)
    • Simplify code post browser support reduction (93ca49e6)
    • Move the factory to separate exports (46f6e3da)
    • Use named exports in `src/` (#5262, f75daab0)
    • Fix regression in jQuery.text() on HTMLDocument objects (#5264, a75d6b52)
    • Selector: Move jQuery.contains from the selector to the core module (024d8719)
    • Drop the root parameter of jQuery.fn.init (d2436df3)
    • Don’t rely on splice being present on input (9c6f64c7)
    • Manipulation: Add basic TrustedHTML support (#4409, de5398a6)
    • Report browser errors in parseXML (#4784, 89697325)
    • Make jQuery.isXMLDoc accept falsy input (#4782, fd421097)
    • Drop support for Edge Legacy (i.e. non-Chromium Microsoft Edge) (#4568, e35fb62d)
    • Fire iframe script in its context, add doc param in globalEval (#4518, 4592595b)
    • Exclude callbacks & deferred modules in the slim build as well (fbc44f52)
    • Migrate from AMD to ES modules 🎉 (d0ce00cd)
    • Use Array.prototype.flat where supported (#4320, 9df4f1de)
    • Remove private copies of push, sort & splice from the jQuery prototype (b59107f5)
    • Implement .even() & .odd() to replace POS :even & :odd (78420d42)
    • Deprecate jQuery.trim (#4363, 5ea59460)
    • Remove IE-specific support tests, rely on document.documentMode (#4386, 3527a384)
    • Drop support for IE <11, iOS <11, Firefox <65, Android Browser & PhantomJS (#3950, #4299, cf84696f)
    • Remove deprecated jQuery APIs (#4056, 58f0c00b)

    CSS

    • Fix reliableTrDimensions support test for initially hidden iframes (b1e66a5f)
    • Selector: Align with 3.x, remove the outer `selector.js` wrapper (53cf7244)
    • Make the reliableTrDimensions support test work with Bootstrap CSS (#5270, 65b85031)
    • Make `offsetHeight( true )`, etc. include negative margins (#3982, bce13b72)
    • Return `undefined` for whitespace-only CSS variable values (#5120) (7eb00196)
    • Don’t trim whitespace of undefined custom property (#5105, ed306c02)
    • Skip falsy values in `addClass( array )`, compress code (#4998, a338b407)
    • Justify use of rtrim on CSS property values (655c0ed5)
    • Trim whitespace surrounding CSS Custom Properties values (#4926, efadfe99)
    • Include `show`, `hide` & `toggle` methods in the jQuery slim build (297d18dd)
    • Remove the opacity CSS hook (865469f5)
    • Workaround buggy getComputedStyle on table rows in IE/Edge (#4490, 26415e08)
    • Don’t automatically add “px” to properties with a few exceptions (#2795, 00a9c2e5)

    Data

    • Refactor to reduce size (805cdb43)
    • Event:Manipulation: Prevent collisions with Object.prototype (#3256, 9d76c0b1)
    • Separate data & css/effects camelCase implementations (#3355, 8fae2120)

    Deferred

    Deprecated

    • Define `.hover()` using non-deprecated methods (fd6ffc5e)
    • Remove jQuery.trim (0b676ae1)
    • Fix AMD parameter order (f810080e)

    Dimensions

    • Add offset prop fallback to FF for unreliable TR dimensions (#4529, 3bbbc111)

    Docs

    • Fix module links in the package README (ace646f6)
    • update watch task in CONTRIBUTING.md (77d6ad71)
    • Fix typos found by codespell (620870a1)
    • remove stale gitter badge from readme (67cb1af7)
    • Remove the “Grunt build” section from the PR template (988a5684)
    • Remove stale badge from README (bcd9c2bc)
    • Update the README of the published package (edccabf1)
    • Remove git.io from a GitHub Actions comment (016872ff)
    • Update webpack website in README (01819bc3)
    • add link to patchwelcome and help wanted issues (924b7ce8)
    • add link to preview the new CLAs (683ceb8f)
    • Fix incorrect `trac-NUMBER` references (eb9ceb2f)
    • remove expired links from old jquery source (#4997) (ed066ac7)
    • Remove links to Web Archive from source (#4981, e24f2dcf)
    • Replace `#NUMBER` Trac issue references with `trac-NUMBER` (5d5ea015)
    • Update the URL to the latest jQuery build in CONTRIBUTING.md (9bdb16cd)
    • Remove the CLA checkbox in the pull request template (e1248931)
    • update irc to Libera and fix LAMP dead link (175db73e)
    • Update Frequently Reported Issues in the GitHub issue template (7a6fae6a)
    • Change JS Foundation mentions to OpenJS Foundation (11611967)
    • add SECURITY.md, show security email address (2ffe54ca)
    • Fix typos (1a7332ce)
    • Update the link to the jsdom repository (a62309e0)
    • Use https for hyperlinks in README (73415da2)
    • Remove a mention of the event/alias.js module from README (3edfa1bc)
    • Update links to EdgeHTML issues to go through Web Archive (1dad1185)
    • direct users to GitHub docs for cloning the repo (f1c16de2)
    • Change OS X to macOS in README (5a3e0664)
    • Update most URLs to HTTPS (f09d9210)
    • Convert link to Homebrew from HTTP to HTTPS (e0022f23)

    Effect

    • Fix a unnecessary conditional statement in .stop() (#4374, 110802c7)

    Effects

    Event

    • Avoid collisions between jQuery.event.special & Object.prototype (bcaeb000)
    • Simplify the check for saved data in leverageNative (dfe212d5)
    • Make trigger(focus/blur/click) work with native handlers (#5015, 6ad3651d)
    • Simulate focus/blur in IE via focusin/focusout (#4856, #4859, #4950, ce60d318)
    • Don’t break focus triggering after `.on(focus).off(focus)` (#4867, e539bac7)
    • Make focus re-triggering not focus the original element back (#4382, dbcffb39)
    • Don’t crash if an element is removed on blur (#4417, 5c2d0870)
    • Remove the event.which shim (#3235, 1a5fff4c)
    • remove jQuery.event.global (18db8717)
    • Only attach events to objects that accept data – for real (#4397, d5c505e3)
    • Stop shimming focusin & focusout events (#4300, 8a741376)
    • Prevent leverageNative from registering duplicate dummy handlers (eb6c0a7c)
    • Fix handling of multiple async focus events (#4350, ddfa8376)

    Manipulation

    • Generalize a test to support IE (88690ebf)
    • Support $el.html(selfRemovingScript) (#5378) (#5377, 937923d9)
    • Extract domManip to a separate file (ee6e8740)
    • Don’t remove HTML comments from scripts (#4904, 2f8f39e4)
    • Respect script crossorigin attribute in DOM manipulation (#4542, 15ae3614)
    • Avoid concatenating strings in buildFragment (9c98e4e8)
    • Make jQuery.htmlPrefilter an identity function (90fed4b4)
    • Selector: Use the nodeName util where possible to save size (4504fc3d)

    Release

    • use buildDefaultFiles directly and pass version (b507c864)
    • copy dist-module folder as well (63767650)
    • only published versioned files to cdn (3a0ca684)
    • remove scripts and dev deps from dist package.json (7eac932d)
    • update build command in Release.generateArtifacts (3b963a21)
    • add support for md5 sums in windows (f088c366)
    • remove the need to install grunt globally (b2bbaa36)
    • upgrade release dependencies (967af732)
    • Remove an unused chalk dependency (bfb6897c)
    • Use an in-repository dist README fixture (358b769a)
    • Update AUTHORS.txt (1b74660f)
    • update AUTHORS.txt (cf9fe0f6)

    Selector

    • Make `selector.js` module depend on `attributes/attr.js` (#5379, e06ff088)
    • Eliminate `selector.js` depenencies from various modules (e8b7db4b)
    • Re-expose jQuery.find.{tokenize,select,compile,setDocument} (#5259, 338de359)
    • Stop relying on CSS.supports( “selector(…)” ) (#5194, 68aa2ef7)
    • Backport jQuery selection context logic to selector-native (#5185, 2e644e84)
    • Make selector lists work with `qSA` again (#5177, 09d988b7)
    • Implement the `uniqueSort` chainable method (#5166, 5266f23c)
    • Re-introduce selector-native.js (4c1171f2)
    • Manipulation: Fix DOM manip within template contents (#5147, 3299236c)
    • Drop support for legacy pseudos, test custom pseudos (8c7da22c)
    • Use jQuery `:has` if `CSS.supports(selector(…))` non-compliant (#5098, d153c375)
    • Remove the “a:enabled” workaround for Chrome <=77 (c1ee33ad)
    • Make empty attribute selectors work in IE again (#4435, 05184cc4)
    • Use shallow document comparisons in uniqueSort (#4441, 15750b0a)
    • Add a test for throwing on post-comma invalid selectors (6eee5f7f)
    • Make selectors with leading combinators use qSA again (ed66d5a2)
    • Use shallow document comparisons to avoid IE/Edge crashes (#4441, aa6344ba)
    • reduce size, simplify setDocument (29a9544a)
    • Leverage the :scope pseudo-class where possible (#4453, df6a7f7f)
    • Bring back querySelectorAll shortcut usage (cef4b731)
    • Inline Sizzle into the selector module (47835965)
    • Port Sizzle tests to jQuery (79b74e04)

    Support

    • ensure display is set to block for the support div (#4832, 09f25436)

    Tests

    • Disable the “:lang respects escaped backslashes” test (#5271, 62b9a258)
    • Indicate Chrome 112 & Safari 16.4 pass the cssHas support test (89ef81f8)
    • Test AJAX deprecated event aliases properly (cff28998)
    • Indicate Firefox 106+ passes the `cssSupportsSelector` test (716130e0)
    • Remove a workaround for a Firefox XML parsing issue (e7ffe1f1)
    • Fix the link to QUnit CSS file (8cf39b78)
    • Exclude tests based on compilation flags, not API presence (#5069, fae5fee8)
    • Workaround an XML parsing bug in Firefox (af1cd6f2)
    • lock colors version to 1.4.0 (9603b3c8)
    • Skip ETag AJAX tests on TestSwarm (00c060d1)
    • Allow statusText to be “success” in AJAX tests (19ced963)
    • Make Karma browser timeout larger than the QUnit one (4fd6912b)
    • Don’t remove csp.log in the cspClean action of mock.php (1019074f)
    • Load the TestSwarm listener via HTTPS (d225639a)
    • Switch background image from online file to local 1×1.jpg (482f8462)
    • Strip untypical callback parameter characters from mock.php (a7027463)
    • Make more tests run natively in Chrome & Firefox (50e8e846)
    • Fix tests for not auto-executing scripts without dataType (d38528b1)
    • Recognize callbacks with dots in the Node.js mock server (df6858df)
    • Skip the “jQuery.ajax() on unload” test in Safari (c18dc496)
    • Remove an unused local variable (82b87f6f)
    • Remove remaining obsolete jQuery.cache references (d96111e1)
    • Workaround failures in recent XSS tests in iOS 8 – 12 (11066a9e)
    • Add tests for recently fixed manipulation XSS issues (dc06d68b)
    • Use only one focusin/out handler per matching window & document (9b732043)
    • Fix flakiness in the “jQuery.ajax() – JSONP – Same Domain” test (7b0864d0)
    • Pass a number of necessary done() calls to assert.async() (364476c3)
    • Remove obsolete jQuery data tests (eb35be52)
    • Skip a “width/height on a table row with phantom borders” test in Firefox (a612733b)
    • Don’t test synchronous XHR on unload in Chrome (323575fb)
    • Stop using jQuery.find in tests (1d624c10)
    • Port changes from Sizzle (ac5f7cd8)
    • Fix a comment in testinit.js (7bdf307b)
    • update npo.js and include unminified source instead (b334ce77)
    • Restrict an event test fallback to TestSwarm (bde53edc)
    • Fix the new focusin/focusout test in IE (6f2fae7c)
    • Fix the core-js polyfill inclusion method (2e4b79ab)

    Traversing

    • Fix `contents()` on `<object>`s with children in IE (ccbd6b93)
    • Fix `contents()` on `<object>`s with children (#4384, 4d865d96)

jQuery 3.7.1 Released: Reliable Table Row Dimensions

Posted on by

jQuery 3.7.1 has been released! This release fixes a regression from jQuery 3.6.0 that resulted in rounded dimensions for <tr /> elements in Chrome and Safari. Also, a (mostly) internal Sizzle method, jQuery.find.tokenize that was on the jQuery object was accidentally removed when we removed Sizzle in jQuery 3.7.0. That method has been restored.

As usual, the release is available on our cdn and the npm package manager. Other third party CDNs will probably have it soon as well, but remember that we don’t control their release schedules and they will need some time. Here are the highlights for jQuery 3.7.1.

Support Test for Table Rows

jQuery 3.6.0 introduced a change to a support test to account for a sudden failure from Firefox, which started including table borders in computed dimensions for <tr /> elements. That may be actually be correct, but Firefox is the only browser doing it. However, that new support test didn’t account for pages with * { box-sizing: border-box; } in CSS. And so, the support test failed on those pages in all browsers. The result was a fallback to use outerWidth and outerHeight, which unfortunately doesn’t return fractional values. The support test has now been fixed and previous behavior has been restored for Chrome and Safari, but Firefox and IE will continue to return integers.

Re-exposing Methods from Sizzle

jQuery has inlined most of the code from Sizzle in jQuery 3.7.0 in preparation for larger changes coming to the jQuery selector engine in the future. For the most part, there were no functional changes, but we did accidentally privatize a method that used to be public. While jQuery.find.tokenize was not documented, some code relied on it being available. That method has now been restored.

Upgrading

We do not expect compatibility issues when upgrading from a jQuery 3.0+ version. To upgrade, have a look at the new 3.5 Upgrade Guide. If you haven’t yet upgraded to jQuery 3+, first have a look at the 3.0 Upgrade Guide.

The jQuery Migrate plugin will help you to identify compatibility issues in your code. Please try out this new release and let us know about any issues you experienced.

If you can’t yet upgrade to 3.5+, Daniel Ruf has kindly provided patches for previous jQuery versions.

Download

You can get the files from the jQuery CDN, or link to them directly:

https://code.jquery.com/jquery-3.7.1.js

https://code.jquery.com/jquery-3.7.1.min.js

You can also get this release from npm:

npm install jquery@3.7.1

Slim build

Sometimes you don’t need ajax, or you prefer to use one of the many standalone libraries that focus on ajax requests. And often it is simpler to use a combination of CSS and class manipulation for web animations. Along with the regular version of jQuery that includes the ajax and effects modules, we’ve released a “slim” version that excludes these modules. The size of jQuery is very rarely a load performance concern these days, but the slim build is about 6k gzipped bytes smaller than the regular version. These files are also available in the npm package and on the CDN:

https://code.jquery.com/jquery-3.7.1.slim.js

https://code.jquery.com/jquery-3.7.1.slim.min.js

These updates are already available as the current versions on npm and Bower. Information on all the ways to get jQuery is available at https://jquery.com/download/. Public CDNs receive their copies today, please give them a few days to post the files. If you’re anxious to get a quick start, use the files on our CDN until they have a chance to update.

Thanks

Thank you to all of you who participated in this release by submitting patches, reporting bugs, or testing, including Gabriela Gutierrez, Michal Golebiowski-Owczarek, Timo Tijhof, Dimitri Papadopoulos Orfanos and the whole jQuery team.

We’re on Mastodon!

jQuery now has its very own Mastodon account. We will be cross posting to both Twitter and Mastodon from now on. Also, you may be interested in following some of our team members that have Mastodon accounts.

jQuery: https://social.lfx.dev/@jquery

mgol: https://hachyderm.io/@mgol

timmywil: https://hachyderm.io/@timmywil

Changelog

Full changelog: 3.7.1

Build

  • Generate the slim build on `grunt` & run `compare_size` on it (763ade6d)
  • Make sure `*.cjs` & `*.mjs` files use UNIX line endings as well (3c18c1f3)
  • switch preferred email for timmywil (72ae577c)
  • Build: Bump actions/checkout from 3.5.2 to 3.5.3 (a370d7df)
  • Reference GitHub Actions by commit SHAs (#5266, 0ea85dad)
  • Test on Node.js 20, stop testing on Node.js 14 & 19 (b473729d)
  • Updating the 3.x-stable version to 3.7.1-pre. (64460dac)

Core

  • Fix regression in jQuery.text() on HTMLDocument objects (#5264, 44c56f87)

CSS

  • Make the reliableTrDimensions support test work with Bootstrap CSS (3.x version) (#5270, a288838c)

Deprecated

  • Define `.hover()` using non-deprecated methods (7287894f)

Docs

  • Fix typos found by codespell (4a29888c)
  • remove stale gitter badge from readme (141518e9)
  • Remove the “Grunt build” section from the PR template (992a6653)

Release

Selector

  • Only attach the unload handler in IE & Edge Legacy (#5281, 87467a6f)
  • Re-expose jQuery.find.tokenize (3.x version) (#5259, 13a870b6)

Tests

  • Disable the “:lang respects escaped backslashes” test (#5271, 5aa7d93a)
  • Skip a new `.text()` test in IE 9 (b84146ce)

jQuery 3.7.0 Released: Staying in Order

Posted on by

jQuery 3.7.0 is now available! This release has it all: bug fixes, a new method, and a performance improvement! We even dropped our longtime selector engine: Sizzle. Or, I should say, we moved it into jQuery. jQuery no longer depends on Sizzle as a separate project, but has instead dropped its code directly into jQuery core. This helps us prepare for the major changes coming to selection in future jQuery versions. That doesn’t mean much right now, but jQuery did drop a few bytes because Sizzle supports even older browsers than jQuery. As an aside, we do plan on archiving Sizzle, but we’ll have more details on that in a future blog post.

As usual, the release is available on our cdn and the npm package manager. Other third party CDNs will probably have it soon as well, but remember that we don’t control their release schedules and they will need some time. Here are the highlights for jQuery 3.7.0.

New method: .uniqueSort()

Some APIs, like .prevAll(), return elements in reverse order, which can result in some confusing behavior when used with wrapping methods. For example,

$elem.prevAll().wrapAll("<p/>")

The above would wrap all of the elements as expected, but it would write those elements to the DOM in reverse order. To solve this in a way that prevented breaking existing code, we’ve documented that .prevAll() and similar methods return reverse-order collections, which is still desirable in many cases. But we’ve also added a new method to make things easier: a chainable .uniqueSort(), which does the equivalent of the existing but static jQuery.uniqueSort().

So, our previous example would become:

$elem.prevAll().uniqueSort().wrapAll("<p/>")

and the element order in the DOM would remain the same.

Added some unitless CSS properties

jQuery 3.7.0 adds support for more CSS properties that should not automatically have “px” added to them when they are set without units. For instance, .css('aspect-ratio', 5) would result in the CSS aspect-ratio: 5px;. All in all, we added seven more properties, and we got a little help with our list from React. Thanks, React!

It’s worth noting that jQuery 4.0 will change the way we handle unitless CSS properties. Rather than relying on a list of CSS properties to avoid adding "px", we’ll instead have an list of properties to which we definitely want to add "px" when there are no units passed. That should be more future-proof.

Performance improvement in manipulation

jQuery 3.7.0 comes with a measurable performance improvement for some use cases when using manipulation methods like .append(). When we removed a support test for a browser we no longer support, it meant that checks against document changes no longer needed to run at all. Essentially, that resulted in a speedup anywhere between 0% and 100%. The most significant speedup will be for some rare cases where users frequently switch contexts between different documents, perhaps by running manipulations across multiple iframes.

Negative margins in outerHeight(true)

Back in jQuery 3.3.0, we fixed an issue to include scroll gutters in the calculations for .innerWidth() and .innerHeight(). However, that fix didn’t take negative margins into account, which meant that .outerWidth(true) and .outerHeight(true) no longer respected negative margins. We’ve fixed that in 3.7.0 by separating the margin calculations from the scroll gutter adjustments.

Using different native focus events in IE

Focus and blur events are probably the most complicated events jQuery has to deal with across browsers. jQuery 3.4.0 introduced some minor regressions when it fixed an issue with the data passed through focus events. We were finally able to close all of those tickets in jQuery 3.7.0!

But, we need to point out a possible breaking change in IE. In all versions of IE, focus & blur events are fired asynchronously. In all other browsers, those events are fired synchronously. The asynchronous behavior in IE caused issues. The fix was to change which events we used natively. Fortunately, focusin & focusout are run synchronously in IE, and so we now simulate focus via focusin and blur via focusout in IE. That one change allowed us to rely on synchronous focus events in IE, which solved a lot of issues (see the changelog for the full list).

If you’re curious, support for IE will be dropped in jQuery 5.0 and many of those changes are already in a PR.

Upgrading

We do not expect compatibility issues when upgrading from a jQuery 3.0+ version. To upgrade, have a look at the new 3.5 Upgrade Guide. If you haven’t yet upgraded to jQuery 3+, first have a look at the 3.0 Upgrade Guide.

The jQuery Migrate plugin will help you to identify compatibility issues in your code. Please try out this new release and let us know about any issues you experienced.

If you can’t yet upgrade to 3.5+, Daniel Ruf has kindly provided patches for previous jQuery versions.

Download

You can get the files from the jQuery CDN, or link to them directly:

https://code.jquery.com/jquery-3.7.0.js

https://code.jquery.com/jquery-3.7.0.min.js

You can also get this release from npm:

npm install jquery@3.7.0

Slim build

Sometimes you don’t need ajax, or you prefer to use one of the many standalone libraries that focus on ajax requests. And often it is simpler to use a combination of CSS and class manipulation for web animations. Along with the regular version of jQuery that includes the ajax and effects modules, we’ve released a “slim” version that excludes these modules. The size of jQuery is very rarely a load performance concern these days, but the slim build is about 6k gzipped bytes smaller than the regular version. These files are also available in the npm package and on the CDN:

https://code.jquery.com/jquery-3.7.0.slim.js

https://code.jquery.com/jquery-3.7.0.slim.min.js

These updates are already available as the current versions on npm and Bower. Information on all the ways to get jQuery is available at https://jquery.com/download/. Public CDNs receive their copies today, please give them a few days to post the files. If you’re anxious to get a quick start, use the files on our CDN until they have a chance to update.

Thanks

Thank you to all of you who participated in this release by submitting patches, reporting bugs, or testing, including fecore1, Michal Golebiowski-Owczarek and the whole jQuery team.

We’re on Mastodon!

jQuery now has its very own Mastodon account. We will be cross posting to both Twitter and Mastodon from now on. Also, you may be interested in following some of our team members that have Mastodon accounts.

jQuery: https://social.lfx.dev/@jquery

mgol: https://hachyderm.io/@mgol

timmywil: https://hachyderm.io/@timmywil

Changelog

Full changelog: 3.7.0

Build

  • Only install Playwright dependencies when needed (212b6a4f)
  • Bump actions/setup-node from 3.5.1 to 3.6.0 (582785e0)
  • Run GitHub Action browser tests on Playwright WebKit (da7057e9)
  • Migrate middleware-mockserver to modern JS (6b2abbdc)
  • remove stale Insight package from custom builds (37b04d5a)

CSS

  • Make `offsetHeight( true )`, etc. include negative margins (#3982, 7bb48a02)
  • Add missing jQuery.cssNumber entries (#5179, 3eed2820)

Deferred

  • Rename `getStackHook` to `getErrorHook` (3.x version) (#5201, cca71186)

Docs

  • Remove stale badge from README (e062f9cb)
  • update irc to Libera and fix LAMP dead link (e0c670e6)

Event

  • Simplify the check for saved data in leverageNative (9ab26aa5)
  • Make trigger(focus/blur/click) work with native handlers (#5015, 754108fb)
  • Simulate focus/blur in IE via focusin/focusout (3.x version) (#4856, #4859, #4950, 59f7b55b)

Release

  • add support for md5 sums in windows (3b7bf199)

Selector

  • Remove an obsolete comment (14685b31)
  • Wrap activeElement access in try-catch (3936cf3e)
  • Stop relying on CSS.supports( “selector(…)” ) (#5194, 63c3af48)
  • Rename rcombinators to rleadingCombinator (ac1c59a3)
  • Make selector lists work with `qSA` again (#5177, 848de625)
  • Implement the `uniqueSort` chainable method (#5166, 0acbe643)
  • Inline Sizzle into the selector module: 3.x version (#5113) (6306ca49)

Tests

  • Indicate Chrome 112 & Safari 16.4 pass the cssHas support test (3.x version) (1a4d87af)
  • Fix tests added in gh-5233 (759232e5)
  • Add tests for arary data in ajax (4837a95b)
  • Skip jQuery.Deferred.exceptionHook tests in IE 9 (98dd622a)
  • Test AJAX deprecated event aliases properly (18139213)
  • Fix selector tests in Chrome (732592c2)
  • Skip the native :valid tests in IE 9 (6b2094da)

jQuery 3.6.4 Released: Selector Forgiveness

Posted on by

If you’ve been following along with recent jQuery releases, we have been working on how to address the recent addition of some new selectors in browsers, especially :has. jQuery 3.6.3 settled on the strategy of using native CSS.supports to determined whether a selector should be passed directly to querySelectorAll or instead go through jQuery’s selector engine, as might be the case when using jQuery selector extensions, complex :not(), or other selectors that are valid in jQuery but not in the browser. That all technically worked fine, but came with a downside. Fortunately for us, the fix is no longer necessary and we can go back to the old way. More on that below.

As usual, the release is available on our cdn and the npm package manager. Other third party CDNs will probably have it soon as well, but remember that we don’t control their release schedules and they will need some time. Here are the highlights for jQuery 3.6.4.

The Difference Between What Is Right and What Is Allowed

Whenever you use a selector in CSS, or JS, there is more than one spec involved. There’s a spec to determine whether a selector is valid (i.e. Selectors) and there’s a spec to guide implementers in how a selector should be parsed (i.e. the parser algorithm for consuming a simple block). The parser implementation is more forgiving than the selector spec itself, to allow for things like attribute selectors missing the last ] character.

When we addressed an issue with some selectors that were being added to modern browsers—specifically :has—we started making use of another API available in most of our supported browsers—CSS.supports—to determine whether a selector could safely be passed to native querySelectorAll or whether it needed to go through jQuery’s selector engine. Selectors may need to bypass qSA for multiple reasons. It may be a jQuery-only selector extension (:contains), a standard selector that jQuery supports in a more robust way (:not(complex)), or a selector we know to be buggy sometimes (:enabled or :disabled). Whatever the reason, the introduction of “forgiving parsing” in selectors like :has made our previous way of determining that an issue because the browser would no longer throw errors for some truly invalid selectors. For instance, :has(:contains) no longer threw an error when passed to querySelectorAll. Neither did :has(:monkey) for that matter. CSS.supports seemed to be the answer.

And yet, every solution can have a trade-off. The problem now was that selectors that were technically invalid according to the Selectors spec were throwing errors. But these same selectors used to work fine because the parsers were more, for lack of a better term, forgiving. Essentially, CSS.supports is not as forgiving as the parser.

Meanwhile, in our discussions with spec writers and vendors, it was agreed that we needed to prevent issues similar to the one with :has from happening again in the future. What does that mean? It means we can go back to the old way . . . mostly. While the spec has been updated, browsers will need some time to update their implementations. And because of that, we still recommend upgrading jQuery to the latest version.

Upgrading

We do not expect compatibility issues when upgrading from a jQuery 3.0+ version. To upgrade, have a look at the new 3.5 Upgrade Guide. If you haven’t yet upgraded to jQuery 3+, first have a look at the 3.0 Upgrade Guide.

The jQuery Migrate plugin will help you to identify compatibility issues in your code. Please try out this new release and let us know about any issues you experienced.

If you can’t yet upgrade to 3.5+, Daniel Ruf has kindly provided patches for previous jQuery versions.

Download

You can get the files from the jQuery CDN, or link to them directly:

https://code.jquery.com/jquery-3.6.4.js

https://code.jquery.com/jquery-3.6.4.min.js

You can also get this release from npm:

npm install jquery@3.6.4

Slim build

Sometimes you don’t need ajax, or you prefer to use one of the many standalone libraries that focus on ajax requests. And often it is simpler to use a combination of CSS and class manipulation for web animations. Along with the regular version of jQuery that includes the ajax and effects modules, we’ve released a “slim” version that excludes these modules. The size of jQuery is very rarely a load performance concern these days, but the slim build is about 6k gzipped bytes smaller than the regular version. These files are also available in the npm package and on the CDN:

https://code.jquery.com/jquery-3.6.4.slim.js

https://code.jquery.com/jquery-3.6.4.slim.min.js

These updates are already available as the current versions on npm and Bower. Information on all the ways to get jQuery is available at https://jquery.com/download/. Public CDNs receive their copies today, please give them a few days to post the files. If you’re anxious to get a quick start, use the files on our CDN until they have a chance to update.

Thanks

Thank you to all of you who participated in this release by submitting patches, reporting bugs, or testing, including Michal Golebiowski-Owczarek and the whole jQuery team.

We’re on Mastodon!

jQuery now has its very own Mastodon account. We will be cross posting to both Twitter and Mastodon from now on. Also, you may be interested in following some of our team members that have Mastodon accounts.

jQuery: https://social.lfx.dev/@jquery

mgol: https://hachyderm.io/@mgol

timmywil: https://hachyderm.io/@timmywil

Changelog

Full changelog: 3.6.4

Build

  • Update Sizzle from 2.3.9 to 2.3.10 (#5194, dbe09e39)
  • Updating the 3.6-stable version to 3.6.4-pre. (a0d68b84)

jQuery 3.6.3 Released: A Quick Selector Fix

Posted on by

Last week, we released jQuery 3.6.2. There were several changes in that release, but the most important one addressed an issue with some new selectors introduced in most browsers, like :has(). We wanted to release jQuery 3.6.3 quickly because an issue was reported that revealed a problem with our original fix. More details on that below.

As usual, the release is available on our cdn and the npm package manager. Other third party CDNs will probably have it soon as well, but remember that we don’t control their release schedules and they will need some time. Here are the highlights for jQuery 3.6.3.

Using CSS.supports the right way

After the issue with :has that was fixed in jQuery 3.6.2, we started using CSS.supports( "selector(SELECTOR)") to determine whether a selector would be valid if passed directly to querySelectorAll. When CSS.supports returned false, jQuery would then fall back to its own selector engine (Sizzle). Apparently, our implementation had a bug. In CSS.supports( "selector(SELECTOR)"), SELECTOR needed to be a <complex-selector> and not a <complex-selector-list>. For example:

CSS.supports("selector(div)"); // true
CSS.supports("selector(div, span)"); // false

This meant that all complex selector lists were passed through Sizzle instead of querySelectorAll. That’s not necessarily a problem in most cases, but it does mean that some level 4 selectors that were supported in browsers but not in Sizzle, like :valid, no longer worked if it was part of a selector list (e.g. "input:valid, div"). It should be noted this currently only affects Firefox, but it will be true in all browsers as they roll out changes to CSS.supports.

This has now been fixed in jQuery 3.6.3 and it is the only functional change in this release.

Upgrading

We do not expect compatibility issues when upgrading from a jQuery 3.0+ version. To upgrade, have a look at the new 3.5 Upgrade Guide. If you haven’t yet upgraded to jQuery 3+, first have a look at the 3.0 Upgrade Guide.

The jQuery Migrate plugin will help you to identify compatibility issues in your code. Please try out this new release and let us know about any issues you experienced.

If you can’t yet upgrade to 3.5+, Daniel Ruf has kindly provided patches for previous jQuery versions.

Download

You can get the files from the jQuery CDN, or link to them directly:

https://code.jquery.com/jquery-3.6.3.js

https://code.jquery.com/jquery-3.6.3.min.js

You can also get this release from npm:

npm install jquery@3.6.3

Slim build

Sometimes you don’t need ajax, or you prefer to use one of the many standalone libraries that focus on ajax requests. And often it is simpler to use a combination of CSS and class manipulation for web animations. Along with the regular version of jQuery that includes the ajax and effects modules, we’ve released a “slim” version that excludes these modules. The size of jQuery is very rarely a load performance concern these days, but the slim build is about 6k gzipped bytes smaller than the regular version. These files are also available in the npm package and on the CDN:

https://code.jquery.com/jquery-3.6.3.slim.js

https://code.jquery.com/jquery-3.6.3.slim.min.js

These updates are already available as the current versions on npm and Bower. Information on all the ways to get jQuery is available at https://jquery.com/download/. Public CDNs receive their copies today, please give them a few days to post the files. If you’re anxious to get a quick start, use the files on our CDN until they have a chance to update.

Thanks

Thank you to all of you who participated in this release by submitting patches, reporting bugs, or testing, including Michal Golebiowski-Owczarek and the whole jQuery team.

Changelog

Full changelog: 3.6.3

Build

  • remove stale Insight package from custom builds (81d5bd17)
  • Updating the 3.x-stable version to 3.6.3-pre. (2c5b47c4)

Selector

jQuery 3.6.2 Released!

Posted on by

You probably weren’t expecting another release so soon, but jQuery 3.6.2 has arrived! The main impetus for this release was the introduction of some new selectors in Chrome. More on that below.

As usual, the release is available on our cdn and the npm package manager. Other third party CDNs will probably have it soon as well, but remember that we don’t control their release schedules and they will need some time. Here are the highlights for jQuery 3.6.2.

undefined and whitespace-only CSS variables

jQuery 3.6.1 introduced a minor regression where attempting to retrieve a value for a custom CSS property that didn’t exist (i.e. $elem.css("--custom")) threw an error instead of returning undefined. This has been fixed in 3.6.2. Related to that, we also made sure that whitespace-only values return the same thing across all browsers. The spec requires that CSS variable values be trimmed, but browsers are inconsistent in their trimming. We now return undefined for whitespace-only values to make it consistent with older jQuery and across the different browsers.

.contains() with <template>

An issue was recently reported that showed that a <template>‘s document had its documentElement property set to null, in compliance with the spec. While it made sense semantically for a template to not yet be tied to a document, it made for an unusual case, specifically in jQuery.contains() and any methods relying on it. That included manipulation and selector methods. Fortunately, the fix was simple.

It wasn’t Ralph that broke the internet

The internet experienced a bit of a rumble when Chrome recently introduced some new selectors, the most pertinent of which being :has(). It was a welcome addition, and one celebrated by the jQuery team, but a change to the spec meant that :has() used what’s called “forgiving parsing”. Essentially, even if the arguments for :has() were invalid, the browser returned no results instead of throwing an error. That was problematic in cases where :has() contained another jQuery selector extension (e.g. :has(:contains("Item"))) or contained itself (:has(div:has(a))). Sizzle relied on errors like that to know when to trust native querySelectorAll and when to run the selector through Sizzle. Selectors that used to work were broken in all jQuery versions dating back to the earliest jQuery versions.

And yet, this little drama didn’t last long. The Chrome team quickly implemented a workaround to fix previous jQuery versions in the vast majority of cases. Safari handled their implementation of :has() a little differently and didn’t have the same problem. But, there’s still an important issue open to determine how to address this in the CSS spec itself. The CSSWG has since resolved the issue.

jQuery has taken steps to ensure that any forgiving parsing doesn’t break future jQuery versions, even if previous jQuery versions would still be affected.

Upgrading

We do not expect compatibility issues when upgrading from a jQuery 3.0+ version. To upgrade, have a look at the new 3.5 Upgrade Guide. If you haven’t yet upgraded to jQuery 3+, first have a look at the 3.0 Upgrade Guide.

The jQuery Migrate plugin will help you to identify compatibility issues in your code. Please try out this new release and let us know about any issues you experienced.

If you can’t yet upgrade to 3.5+, Daniel Ruf has kindly provided patches for previous jQuery versions.

Download

You can get the files from the jQuery CDN, or link to them directly:

https://code.jquery.com/jquery-3.6.2.js

https://code.jquery.com/jquery-3.6.2.min.js

You can also get this release from npm:

npm install jquery@3.6.2

Slim build

Sometimes you don’t need ajax, or you prefer to use one of the many standalone libraries that focus on ajax requests. And often it is simpler to use a combination of CSS and class manipulation for web animations. Along with the regular version of jQuery that includes the ajax and effects modules, we’ve released a “slim” version that excludes these modules. The size of jQuery is very rarely a load performance concern these days, but the slim build is about 6k gzipped bytes smaller than the regular version. These files are also available in the npm package and on the CDN:

https://code.jquery.com/jquery-3.6.2.slim.js

https://code.jquery.com/jquery-3.6.2.slim.min.js

These updates are already available as the current versions on npm and Bower. Information on all the ways to get jQuery is available at https://jquery.com/download/. Public CDNs receive their copies today, please give them a few days to post the files. If you’re anxious to get a quick start, use the files on our CDN until they have a chance to update.

Thanks

Thank you to all of you who participated in this release by submitting patches, reporting bugs, or testing, including sashashura, Anders Kaseorg, Michal Golebiowski-Owczarek, and the whole jQuery team.

Changelog

Full changelog: 3.6.2

CSS

  • Return undefined for whitespace-only CSS variable values (#5120) (8bea1dec)
  • Don’t trim whitespace of undefined custom property (#5105, c0db6d70)

Selector

Tests

  • Remove a workaround for a Firefox XML parsing issue (965391ab)
  • Make Ajax tests pass in iOS 9 (d051e0e3)

jQuery 3.6.1 Maintenance Release

Posted on by

jQuery 3.6.1 has been released! It’s been a while since our previous release. We were looking at fixing some elusive edge cases related to focus and blur, but we never quite got the fix right. If there’s any area of jQuery that’s hard to change, it’s likely related to focus somehow. We’re leaving those as-is for now and will address them in the future, especially since the changes may end up warranting a major version release. See gh-4856 and gh-4950 for more details.

That said, this release still comes with some important fixes, detailed below.

As usual, the release is available on our cdn and the npm package manager. Other third party CDNs will probably have it soon as well, but remember that we don’t control their release schedules and they will need some time. Here are the highlights for jQuery 3.6.1:

Infrastructure Improvements

We’ve done a lot of work in this release to update some of our testing and build infrastructure, including migrating CI from Travis CI to GitHub Actions, testing on Node 16 instead of Node 15, loading our testing listener over https, and adding more accurate testing for custom builds. We also removed some old links from comments in some files in the repo. These links were to URLs that have since been compromised. While these files were never distributed in a release, they still existed in the GitHub source and have been removed.

Not losing focus

There’s still one fix related to focus in this release. Our special event handling for focus remained attached even after jQuery focus handlers were removed, which broke any subsequent manual focus triggers. For example,

$elem
  .on("focus", function() {})
  .off("focus")
  .trigger("focus");

would not trigger focus.

Skipping falsey in addClass( array )

Without any size increase, we added support for skipping over any falsey values in an array passed to addClass or removeClass.

This makes code like:

elem.addClass( [ "a", "", "b" ] );

add both the a & b classes.

Aligning with the spec for custom CSS property values

A change to the CSS spec requires that custom properties be trimmed. Whitespace is now trimmed for custom CSS property values. Before, something like --prop: value ; would retain the leading and trailing spaces in the value, returning ” value “.

Appending scripts with HTML comments

An issue was discovered with our regex that strips HTML comments from scripts when they are appended, which ended up removing parts of the executable script in certain edge cases. Fortunately, our fix was to rely more on the browsers, but we still need to strip CDATA sections for IE in the 3.x branch. That will be removed in 4.0.

A performance boost for jQuery.trim

While jQuery.trim has already been removed on the main branch in favor of native String#trim in preparation for the next major release, it’s still needed on the 3.x branch for some browsers that branch supports, such as Android 4.0. There were certain edge cases that were incredibly slow due to the structure of our regex. That has since been changed and the speed-up is significant.

Upgrading

We do not expect compatibility issues when upgrading from a jQuery 3.0+ version. To upgrade, have a look at the new 3.5 Upgrade Guide. If you haven’t yet upgraded to jQuery 3+, first have a look at the 3.0 Upgrade Guide.

The jQuery Migrate plugin will help you to identify compatibility issues in your code. Please try out this new release and let us know about any issues you experienced.

If you can’t yet upgrade to 3.5+, Daniel Ruf has kindly provided patches for previous jQuery versions.

Download

You can get the files from the jQuery CDN, or link to them directly:

https://code.jquery.com/jquery-3.6.1.js

https://code.jquery.com/jquery-3.6.1.min.js

You can also get this release from npm:

npm install jquery@3.6.1

Slim build

Sometimes you don’t need ajax, or you prefer to use one of the many standalone libraries that focus on ajax requests. And often it is simpler to use a combination of CSS and class manipulation for web animations. Along with the regular version of jQuery that includes the ajax and effects modules, we’ve released a “slim” version that excludes these modules. The size of jQuery is very rarely a load performance concern these days, but the slim build is about 6k gzipped bytes smaller than the regular version. These files are also available in the npm package and on the CDN:

https://code.jquery.com/jquery-3.6.1.slim.js

https://code.jquery.com/jquery-3.6.1.slim.min.js

These updates are already available as the current versions on npm and Bower. Information on all the ways to get jQuery is available at https://jquery.com/download/. Public CDNs receive their copies today, please give them a few days to post the files. If you’re anxious to get a quick start, use the files on our CDN until they have a chance to update.

Thanks

Thank you to all of you who participated in this release by submitting patches, reporting bugs, or testing, including fecore1, Richard Gibson, Simon Legner, Michal Golebiowski-Owczarek, Vladimir Sitnikov, Timo Tijhof, Christian Oliff, ygj6, and the whole jQuery team.

Changelog

Full changelog: 3.6.1

CSS

  • Skip falsy values in `addClass( array )`, compress code (#4998, 9b34bdb1)
  • Justify use of rtrim on CSS property values (a1373e2e)
  • Remove a redundant extension from rtrimCSS inclusion in curCSS (509eeb89)
  • Trim whitespace surrounding CSS Custom Properties values (#4926, 219ccf5c)

Deprecated

  • Improve $.trim performance for strings with lots of whitespace (69940100)

Docs

  • Update webpack website in README (410d5cf0)
  • add link to preview the new CLAs (b24e83bd)
  • Replace `#NUMBER` Trac issue references with `trac-NUMBER` (95e34b69)
  • remove expired links from old jquery source (c3c4d207)
  • Remove links to Web Archive from source (#4981, 4b0d8900)
  • Update the URL to the latest jQuery build in CONTRIBUTING.md (4bb7d069)
  • Remove the CLA checkbox in the pull request template (93406490)

Event

  • Don’t break focus triggering after `.on(focus).off(focus)` (#4867, b3e4a7eb)

Manipulation

Tests

  • Exclude tests based on compilation flags, not API presence (3.x version) (#5069, bc165128)
  • Workaround an XML parsing bug in Firefox (be3bd560)
  • lock colors version to 1.4.0 (fa70e8fd)
  • Skip ETag AJAX tests on TestSwarm (81fa1e2a)
  • Allow statusText to be “success” in AJAX tests (7439e221)
  • Disable CSS Custom Properties tests in old Safari/iOS (e9f77267)
  • Make Karma browser timeout larger than the QUnit one (a51eec74)
  • Don’t remove csp.log in the cspClean action of mock.php (ba81326f)
  • Load the TestSwarm listener via HTTPS (f6f07204)
  • Switch background image from online file to local 1×1.jpg (8d20cb97)
  • Strip untypical callback parameter characters from mock.php (b14b62c8)

Infrastructure

  • Update GitHub Actions (0f6c3d9e)
  • Add dependabot.yml config (GitHub Actions) (5a363017)
  • Test on Node 17, update Grunt & `karma-*` packages (9bc0df70)
  • Separate the install step from running tests in GitHub Actions (cb35067f)
  • remove travis.yml and travis mentions from core (#4984) (55669883)
  • Migrate CI to GitHub Actions (b39cfa15)
  • Test on Node.js 16 instead of 15 (f12cac60)
  • Take core-js from the external directory as well (752b8981)
  • Updating the 3.x-stable version to 3.6.1-pre. (3642471e)

jQuery maintainers continue modernization initiative with deprecation of jQuery Mobile

Posted on by

By: Michal Golebiowski-Owczarek, Felix Nagel, and the jQuery team

Editor’s Note: the following blog post was originally published to the OpenJS Foundation Blog.

jQuery maintainers are continuing to modernize its overall project that still is one of the most widely deployed JavaScript libraries today. The team announced that the cross-platform jQuery Mobile project under its umbrella will be fully deprecated as of October 7, 2021. New technologies for mobile app development have evolved since this project was launched in 2010, so we’re encouraging developers to plan for this jQuery Mobile transition.

Please note that:

  • The Download Builder will remain available.
  • Mobile 1.4 is not compatible with the new jQuery Core.
  • Issues will be turned off. Please report critical security bugs via email to security@jquery.com. 

Celebrating jQuery Mobile’s History

jQuery Mobile was conceived and announced in 2010, three years after the launch of jQuery.  The project was exciting and ambitious. At announcement, jQuery Mobile promised compatibility across multiple platforms, browsers, and versions. Several mobile browser vendors, including Palm and Mozilla, signed on to sponsor the project: 


“The jQuery community has focused on making the Web as productive and fun as possible. When we heard the mission behind jQuery Mobile, we wanted to help. With webOS we have shown that the Web platform is fantastic for developers, so we are excited to help make jQuery Mobile as good as it can be.” -Dion Almaer – Palm

At the time, the mobile web was desperately in need of a framework capable of working across all browsers, allowing developers to build truly mobile web applications. jQuery had already changed the way developers were building on the web, making it easier (and faster) to create secure, compliant applications. 

With jQuery Mobile, the project’s goals were to bring the ease-of-use of jQuery to HTML-capable mobile device browsers and to make it easier for developers to build progressively enhanced web applications. Led by Todd Parker of Filament Group, a development studio known for their work on cross platform and accessibility-first applications, jQuery Mobile launched its alpha release in October 2010. 

Alpha features included several components, layouts and theming tools that simplified the process of building a mobile web application. Progressive enhancement and graceful degradation, which were hot (and tricky) topics in web development at the time, featured heavily: jQuery Mobile promised developers and users the best possible experience their platform could handle. Accessibility was another key feature, with Mobile promising a user experience that could be navigated by touch, keyboard, or screen reader via ARIA compatible components. Additional features such as simplicity, file size, and the ability to deploy jQuery Mobile applications through an app store drove further excitement. 

Over the next year, the jQuery Mobile team continued to add compatible platforms and browsers, new components and themes, and eventually a themeroller tool that allowed developers to configure and download themes without writing any CSS. 

The community response was overwhelming – by the time 1.0 was released in November 2011, jQuery Mobile had gathered over 125 contributors, dozens of articles, tutorials and demos, 8 published books, and a gallery of sites, plugins and extensions to welcome and introduce new developers to the project. 

jQuery Mobile continued to make monthly releases throughout 2012 and 2013, regularly adding and improving components, resolving compatibility issues with mobile browsers, and making performance improvements to speed up page rendering times. The development team also continued to prioritize and highlight the importance of responsive web design and accessibility principles with each new release. 

As the number of components and widgets swelled – both those that were officially supported or widely adopted in the community, performance and compatibility issues with mobile platforms, browsers, and jQuery core were also exacerbated. Though the project did have some automated tests, there were still a number of items that needed to be tested manually, which slowed down the development process. 

In mid 2013, Jasper de Groot became the project lead and announced tighter development collaboration between jQuery UI and jQuery Mobile teams, sharing goals, roadmaps and code in order to ease the workload for both groups. The team continued to provide maintenance releases and support, but progress continued to slow under the burden of testing and supporting such a large community. 

Alex Schmitz took over the lead in July 2014, but by that time the size of the project, combined with the pace and availability of new mobile browser features, made finding a viable path forward for the project increasingly difficult. 

The latest stable version was released October 2014. Alex and team made a big push to update jQuery Mobile again in 2017 with the release of an alpha version of 1.5; this version would see compatibility with jQuery 3.0 and npm support among other things.

jQuery Mobile became an OpenJS Foundation Emeritus project in 2018, signifying that the goals of the project had been achieved.

jQuery modernization initiative

The depreciation of jQuery mobile follows the careful transition of another project under the jQuery project umbrella, jQuery UI.

jQuery Core is still actively maintained and widely implemented. As part of its modernization initiative, the team also has been making a series of updates this year to its infrastructure, including migrating and improving its CDN.

Celebrating jQuery Mobile Maintainers and Contributors

The contributions to jQuery Mobile opened up opportunities for people and organizations around the world, and we are thankful for all the contributions over the years. We would like to give an extra shout out of gratitude to the past maintainers of jQuery Mobile: Alexander Schmitz, Jasper de Groot, and Todd Parker.

jQuery maintainers update and transition jQuery UI as part of overall modernization efforts

Posted on by

By: Michal Golebiowski-Owczarek, Felix Nagel, and the jQuery team

Editor’s Note: the following blog post was originally published to the OpenJS Foundation Blog.

The jQuery project is actively maintained and widely implemented — it’s used by 73% of 10 million most popular websites. As part of its ongoing effort to modernize the project, jQuery maintainers have taken steps to wind down one of its projects under the jQuery umbrella through a careful transition. 

Today, jQuery UI announced version 1.13 — its first release in 5 years and the project’s final planned release. Perhaps the most important update is that jQuery UI 1.13 now runs on the latest version of jQuery Core, providing a number of browser compatibility and security updates that have been missing from previous releases, in addition to community fixes and improvements. The jQuery UI Download Builder has also been restored and updated so developers can continue to download UI along with their favorite themes. The release is part of an ongoing series of updates across all jQuery projects.

jQuery UI is in maintenance-only mode. Users should not expect any new releases, though patches may be issued to resolve critical security, interoperability, or regression bugs. Trac, the project’s bug-tracking tool, has been put in read-only mode and developers are asked to file any critical issues on the project’s GitHub repository

jQuery UI was first launched in September 2007 as a curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery library. It quickly gained popularity because it was one of the best tested and most accessible UI frameworks of its time. The tool helped developers build UI components such as form controls and date pickers using the best practices back then. In its heyday, jQuery UI was adopted by a broad set of enterprises including Pinterest, PayPal, IMDB, Huffington Post, and Netflix. 

Today, jQuery UI continues to be an important testbed for jQuery Core updates, helping the maintainer team spot bugs and interoperability issues that arise as the web platform evolves. 

Celebrating jQuery UI’s History

With the launch of jQuery in 2006, web developers were able to access and manipulate DOM and CSS faster and easier than ever before. Thousands of open source jQuery widgets and plugins were created to handle previously tricky problems, like showing and hiding elements, rotating through image carousels, or picking dates on a calendar. The jQuery ecosystem became a playground full of tools for making new and interesting interactions possible on the web. 

‘New and interesting’ doesn’t always translate to ‘good and useful’ — though there were many good plugins available, it was not always easy to tell which would be the most performant or provide the best user experience. Developers might have to go searching for the right tools or worse, spend significant time swapping through several plugins to figure out which one worked best. Further, there were few examples of best practices in user experience on the web, so visitors to one website could have vastly different (and thus confusing) interactions when they performed a similar task on another website. 

Members of the jQuery Core team wanted to help developers write performant, high-quality, and reusable jQuery components for their sites and applications. After some discussion, the idea for a second library with strict standards for coding, documentation, and theming was born. The project’s vision and goals included: developing a collaborative design process; providing flexible styling and themes; creating elegant visual and interaction design; providing a robust API; and prioritizing progressive enhancement, accessibility, internationalization and localization support.

In September 2007, jQuery UI officially launched as a set of user interface interactions, effects, widgets, and themes built on top of jQuery. Soon after, the team shifted their focus to provide a full set of APIs and methods to allow developers to create flexible, full-featured widgets that met high standards of quality. CSS effects such as easing and animation were added in and helped developers create more modern, enhanced experiences. The team at Filament Group later added a ThemeRoller, allowing developers to get started quickly by providing customizable theme boilerplate. ThemeRoller is still operational today.  

By the end of 2008, jQuery UI had an exploding community of users, developers, and interaction designers regularly providing updates and improvements to the project as best practices and style preferences evolved. Between 2009 and 2016, the community provided a variety of new official and unofficial themes and plugins, interoperability and other bug fixes, robust testing processes, and support for multiple versions of jQuery. 

jQuery UI’s prior official release came in September 2016, nearly a decade after it started. In that timeframe, the jQuery community had helped inspire dozens of other open source projects, pattern and component libraries. But newer CSS frameworks and approaches were taking hold, and slowly the community moved on to other projects. The UI team and jQuery Mobile teams merged, and the group focused more on maintenance and compatibility with jQuery Core.  

jQuery UI became an OpenJS Foundation Emeritus project in 2018, recognizing that it was winding down while noting the significance it had for the JavaScript ecosystem.

Celebrating jQuery UI Maintainers and Contributors

The scope of the project and the inclusiveness of the community was responsible for helping countless web makers develop a love and appreciation for user experience, localization, internationalization, accessibility, and clean, reusable code. Though many hours of work and contribution went into making jQuery UI a successful library, the jQuery UI core team deserves extra recognition for more than a decade of hard work shepherding the work and the community throughout the project’s lifecycle. Alex Schmitz, Jörn Zaefferer, Felix Nagel, Mike Sherov, Rafael Xavier de Souza, and Scott González led a team of many core contributors and more than 300 additional authors.

Additional gratitude is owed to Micha? Go??biowski-Owczarek for preparing the 1.13 release and stewarding the repository for the past year. 

OpenJS Foundation will forever be grateful for the work of these open source developers and the impact they had on the ecosystem through their work. Please join us in celebrating these developers and jQuery UI!

jQuery project updates addressing temporary CDN issues

Posted on by

As part of its ongoing infrastructure updates, the jQuery infrastructure team is making configuration and deployment changes to address intermittent outages reported by some users. The issue is the result of faulty IP allowlisting which affects users downloading jQuery project assets from certain IP addresses.

This issue is expected to be resolved in the next few weeks. In the interim, users can mitigate the issue by downloading and serving the files they need.

CDN migration is part of a package of infrastructure improvement projects the project has been undertaking this year. The infrastructure team plans to provide a full overview of these improvements, which will help support the long-term maintenance of jQuery and its related projects, later this summer.

jQuery continues to be a widely-used open source project with active maintainers. While many sites host jQuery locally, others rely upon the jQuery CDN to deliver the library on demand. On average, the jQuery CDN delivers over 2 petabytes of code per month. The project is hosted at the OpenJS Foundation, the vendor-neutral organization to grow and sustain the JavaScript and web ecosystem.