jQuery 3.5.1 Released: Fixing a Regression

Posted on by

I’ve never gotten to say this on a jQuery release, but May the 4th be with you! A short time ago in a galaxy exactly like this one, we released jQuery 3.5.0. We have a quick fix for a regression in that release.

Specifically, we had changed our internal data object to use Object.create( null ) instead of a plain object ({}). We did that to prevent collisions with keys on Object.prototype properties. However, this also meant that users (especially plugins) could no longer check what was in jQuery data with the native .hasOwnProperty() method, and it broke some code. We’ve reverted that change, but plan to put it back in jQuery 4.0. This change is the only code change in this release. Other changes include some minor updates to our docs and build system.

Security fixes in 3.5.0

jQuery 3.5.0 included fixes for two security issues in jQuery’s DOM manipulation methods, as in .html(), .append(), and the others. Security advisories for both of these issues have been published on GitHub. While we provided all of the details on the first issue in the jQuery 3.5.0 blog post, we did not provide all of the details on the second and would like to do that in this post.

The second issue was very similar to the first. It was an XSS vulnerability that had to do with passing <option> elements to jQuery’s DOM manipulation methods. Essentially, we’re using a regex to wrap <option> elements with <select> elements to ensure those elements get parsed correctly in old IE (IE <= 9 replaces any <option> tags with their contents when inserted outside of a <select> element).

Our fix is to only apply this code where it is needed. Fortunately, because of the different parsing behavior in IE9, we can keep the fix in IE9 without exposing it to the same vulnerability as other browsers. Please upgrade when you get a chance to avoid these vulnerabilities.

Upgrading

If you haven’t yet upgraded to jQuery 3.5, have a look at the 3.5 Upgrade Guide. If you haven’t yet upgraded to jQuery 3+, first have a look at the 3.0 Upgrade Guide. Also, the jQuery Migrate plugin will help you to identify compatibility issues in your code.

If you can’t yet upgrade to 3.5+, Daniel Ruf has kindly provided patches for previous jQuery versions. Please try out this new release and let us know about any issues you experienced.

Download

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

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

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

You can also get this release from npm:

npm install jquery@3.5.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.5.1.slim.js

https://code.jquery.com/jquery-3.5.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 Pierre Grimaud, Michal Golebiowski-Owczarek, Ed S, vanillajonathan, and the whole jQuery team.

Changelog

Full changelog: 3.5.1

Build

  • Test on Node.js 14, stop testing on Node.js 8 & 13 (205dd134)
  • Enable reportUnusedDisableDirectives in ESLint (b21d6710)
  • Updating the 3.x-stable version to 3.5.1-pre. (898784ab)

Data

Docs

Tests

  • Workaround failures in recent XSS tests in iOS 8 – 12 (ea2d0d50)
  • Add tests for recently fixed manipulation XSS issues (58a8e879)
  • Cleanup `window` & `document` handlers in a new event test (c1c0598d)
  • Fix flakiness in the “jQuery.ajax() – JSONP – Same Domain” test (46ba70c5)

jQuery 3.5.0 Released!

Posted on by

jQuery 3.5.0 has been released! 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.

We hope you’re staying healthy and safe while so many of us are stuck at home. With a virus ravaging the planet, we realize that jQuery may not be a high priority for you or the sites you manage. When you do have a moment, we recommend that you review this new version and upgrade.

Security Fix

The main change in this release is a security fix, and it’s possible you will need to change your own code to adapt. Here’s why: jQuery used a regex in its jQuery.htmlPrefilter method to ensure that all closing tags were XHTML-compliant when passed to methods. For example, this prefilter ensured that a call like jQuery("<div class='hot' />") is actually converted to jQuery("<div class='hot'></div>"). Recently, an issue was reported that demonstrated the regex could introduce a cross-site scripting (XSS) vulnerability.

The HTML parser in jQuery <=3.4.1 usually did the right thing, but there were edge cases where parsing would have unintended consequences. The jQuery team agreed it was necessary to fix this in a minor release, even though some code relies on the previous behavior and may break. The jQuery.htmlPrefilter function does not use a regex in 3.5.0 and passes the string through unchanged.

If you absolutely need the old behavior, using the latest version of the jQuery migrate plugin provides a function to restore the old jQuery.htmlPrefilter. After including the plugin you can call jQuery.UNSAFE_restoreLegacyHtmlPrefilter() and jQuery will again ensure XHTML-compliant closing tags.

However, to sanitize user input properly, we also recommend using dompurify with the SAFE_FOR_JQUERY option to sanitize HTML from a user. If you don’t need the old behavior, but would still like to sanitize HTML from a user, dompurify should be used without the SAFE_FOR_JQUERY option, starting in jQuery 3.5.0. For more details, please see the 3.5 Upgrade Guide.

Features

With what we call “positional selectors” being deprecated and slated for removal in jQuery 4.0, we’ve added the last two necessary replacement methods. Specifically, we’ve added the .even() and .odd() methods to replace the :even and :odd selectors. With these methods in place, we can safely remove these overly complicated selectors in jQuery 4.0.

Another small feature that we’ve added to this release is the ability to add a context to jQuery.globalEval. This was done as part of fixing a bug with script execution in iframes.

Fixes

One bug worth highlighting is a bug we fixed in the Ajax script transport. jQuery used to evaluate any response to a request for a script as a script, which is not always the desired behavior. This is different than other data types where such a convention was fine (e.g. in the case of JSON). jQuery 3.5.0 will now only evaluate successful HTTP responses.

Other bug fixes and improvements include performance improvements in Sizzle, support for massive arrays in jQuery.map, using the native .flat() method where supported, a fix for syntax errors in the AMD modules, several improvements to our testing infrastructure, and more. You’ll find the full changelog below.

Deprecations

It wouldn’t be a jQuery release without some deprecations. In jQuery 3.5.0, we’ve put jQuery.trim on the list. JavaScript’s own String.prototype.trim() is an easy replacement for it.

We’ve also put AJAX event aliases on the list, they can be replaced by .on("ajaxStart", …) and the like. jQuery Migrate will warn about these now-deprecated methods, but they’ll stick around until jQuery 4.0.

Upgrading

Aside from the change to no longer ensure XHTML-compliant tags for you, we do not expect other 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.5.0.js

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

You can also get this release from npm:

npm install jquery@3.5.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.5.0.slim.js

https://code.jquery.com/jquery-3.5.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 Ahmed S. El-Afifi, Michal Golebiowski-Owczarek, Wonseop Kim, Dave Methvin, Shashanka Nataraj, Pat O’Callaghan, Sean Robinson, Christian Oliff, Christian Wenz, and the whole jQuery team.

We also would like to thank Masato Kinugawa for helping us identify and fix the security-related issues in this release.

Changelog

Full changelog: 3.5.0

Ajax

  • Do not execute scripts for unsuccessful HTTP responses (#4250, #4655, da3dd85b)
  • Overwrite s.contentType with content-type header value, if any (#4119, 065143c2)
  • Deprecate AJAX event aliases, inline event/alias into deprecated (7a3cf9c0)

Build

  • Resolve Travis config warnings (7506c9ca)
  • Enable ESLint one-var rule for var declarations in browser code (0fdfdd82)
  • Test the no-Sizzle build on Travis (362075ae)
  • Update .mailmap & AUTHORS.txt (19f2dcba)
  • Tests: Fix custom build tests, verify on Travis; name Travis jobs (d525ae34)
  • Lint the minified jQuery file as well (#3075, 37df5cdf)
  • Make Karma work in AMD mode (46c284b1)
  • Create a `grunt custom:slim` alias for the Slim build (4cbdc745)
  • Run tests on Travis only on browsers defined in the config (471b0043)
  • Run tests on Firefox ESR as well (0a73b94a)
  • Run tests on Node.js 13 in addition to 8, 10 & 12 (64c1fcc1)
  • Drop workarounds for Node.js 6 in Gruntfile.js (9f4204ec)
  • Run tests on Travis on FirefoxHeadless as well (ad3c2efa)
  • Require strict mode in Node.js scripts via ESLint (ac2da4e6)
  • Support jquery-release –dry-run flag (c7a5e1bd)
  • Stop copying src/core.js to dist on release (#4489, 279d2e97)
  • ESLint: forbid unused function parameters (d7e13f12)
  • Fix the regex parsing AMD var-modules (#4389) (36b59c96)

Core

  • Ajax: Align nonce & global with master, fix an AMD issue (22bf701f)
  • Fire iframe script in its context, add doc param in globalEval (#4518, 3dedc3f2)
  • Deprecate jQuery.trim (#4363, 56e73e0c)
  • Use Array.prototype.flat where supported (#4320, 2f666c1d)
  • Implement .even() & .odd() to replace POS :even & :odd (409cbda7)

CSS

  • Workaround buggy getComputedStyle on table rows in IE/Edge (#4490, 6d31477a)

Data

  • Event:Manipulation: Prevent collisions with Object.prototype (#3256, 413ff796)

Docs

  • Update links to EdgeHTML issues to go through Web Archive (d72faced)
  • Convert link to Homebrew from HTTP to HTTPS (ff5a43eb)

Effect

  • Fix a unnecessary conditional statement in .stop() (#4374, 30f5c6c3)

Event

  • Use only one focusin/out handler per matching window & document (#4652, 9e15d6b4)
  • Only attach events to objects that accept data – for real (#4397, f36f6abb)

Manipulation

  • Skip the select wrapper for option elements
  • Make jQuery.htmlPrefilter an identity function (1d61fd94)

Offset

Selector

Tests

  • Blacklist one focusin test in IE (1a4f10dd)
  • Pass a number of necessary done() calls to assert.async() (5ea844f6)
  • Make the support tests pass on Firefox 4x/5x/60 (f0d5ec62)
  • Skip a “width/height on a table row with phantom borders” test in Firefox (c79e1d5f)
  • Don’t test synchronous XHR on unload in Chrome (c5b48c8c)
  • Fix offset fractions tests in Chrome for Android (0c67da4b)
  • Move Android user agent detection above iOS, put Safari last (6276cb2e)
  • Make support tests accept Safari 13 & newer (8167327f)
  • update npo.js and include unminified source instead (3654bc83)

Traversing

  • Fix contents() on object elements with children in IE (90f78b9a)
  • Fix contents() on object elements with children (#4384, 42badf34)

jQuery 3.4.1: triggering focus events in IE and finding root elements in iOS 10

Posted on by

Hello again! jQuery 3.4.0 was released just three weeks ago, but we’ve had a few issues reported that warranted a patch release. Thank you to everyone that reported issues and helped us get these fixed quickly. Here are the changes:

Triggering focus or blur more than once in IE

jQuery 3.4.0 came with some changes to the way the event handler triggered native events such focus and blur. These changes caused a regression that sometimes resulted in an enigmatic error being thrown in the form of "saved.shift is not a function". This is now fixed.

Example

// Error thrown in IE10-11
// after clicking #test-element twice
jQuery("#test-element").click(function() {
  jQuery(this).trigger("blur");
});

Checking element attachment in iOS 10.0-10.2

When releasing 3.4.0, we ran our tests in several versions of iOS, including iOS 10.3 but not 10.0-10.2. Those versions do not support a native function we use to determine whether an element is attached to the DOM. Other versions of iOS were not affected. We added a guard to ensure that this method exists and fall back to other options if necessary.

Loading jQuery with AMD

A small module was added in jQuery 3.4.0 that used the global jQuery rather than the local jQuery loaded with AMD. This resulted in "jQuery is undefined" errors when loading with AMD, but this should now be fixed.

 


Upgrading

There should be no compatibility issues if upgrading from jQuery 3.0+. If you haven’t yet upgraded to jQuery 3+, please have a look at the 3.0 Upgrade Guide. The jQuery Migrate 3.0 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.

Download

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

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

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

You can also get this release from npm:

npm install jquery@3.4.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.4.1.slim.js

https://code.jquery.com/jquery-3.4.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 Richard Gibson, Michal Golebiowski-Owczarek, and the whole jQuery team.

Changelog

GitHub changelog: Issues fixed in 3.4.1 | All changes

Build

  • Fix unresolved jQuery reference in finalPropName (#4358, 0d4af529)

Core

Event

  • Prevent leverageNative from registering duplicate dummy handlers (6c1e7dbf)
  • Fix handling of multiple async focus events (#4350, 24d71ac7)

jQuery 3.4.0 Released

Posted on by

jQuery has a new release! It’s been a while since our last release, but we expect this to be the last minor release in the 3.x branch, and then we will move on to the overhaul that will be jQuery 4.0. But before we get to 4.0, we’re excited to share the bug fixes and improvements included in jQuery 3.4.0. Here are some of the highlights:

Performance improvement in .width and .height

When getting and setting dimensions, there were certain cases where this could cause layout thrashing, which basically means that the browser calculated layout more times than necessary. We fixed this in all browsers except IE, where it can’t be avoided.

nonce and nomodule support

To support adding script elements through methods like .html and .append, jQuery separates them and appends new script tags to load and execute the remote content. During this process, attributes such as nonce and nomodule were ignored, but jQuery 3.4.0 now hangs onto them.

Radio elements: expected state in event handlers

We had already fixed the same issue with checkboxes, but accidentally left out radio inputs. In the following example, true was logged the first time the element was clicked. We fixed it so that the checked property is updated before the event handler is executed.

Example

var $radios = jQuery(".example");
var $firstRadio = $radios.first();
var firstCheckedState = $firstRadio.prop("checked");
$radio.on("click", function() {
  // true in <3.4.0
  console.log($firstRadio.prop("checked") === firstCheckedState);
});
$radios.eq(1).click();

Minor vulnerability fix: Object.prototype pollution

jQuery 3.4.0 includes a fix for some unintended behavior when using jQuery.extend(true, {}, ...). If an unsanitized source object contained an enumerable __proto__ property, it could extend the native Object.prototype. This fix is included in jQuery 3.4.0, but patch diffs exist to patch previous jQuery versions.

Example

jQuery.extend(true, {},
  JSON.parse('{"__proto__": {"test": true}}')
);
console.log( "test" in {} ); // true

Note that while jQuery does its best to protect users from security vulnerabilities, jQuery is a DOM manipulation library that will generally do what you tell it to do. In this case, the behavior was likely unexpected, so jQuery.extend will no longer write any properties named __proto__. But guards such as this one are not replacements for good security practices such as user input sanitization.

Deprecating positional selectors and the sunset of Sizzle

The basic API of jQuery is to select something and then do something with what was selected. Sizzle, the selector engine in jQuery, handles the first half. It’s been a fast and efficient little engine that has paved the way for native selector APIs like querySelectorAll and additional native JavaScript and CSS selectors. Now that many of these selectors have made their way into modern browsers, it’s almost time to say goodbye to Sizzle. But in order to remove Sizzle in jQuery 4.0, we will also need to remove what we refer to as positional selectors, which are non-standard selectors.

Specifically, jQuery 3.4.0 is deprecating :first, :last, :eq, :even, :odd, :lt, :gt, and :nth. When we remove Sizzle, we’ll replace it with a small wrapper around querySelectorAll, and it would be almost impossible to reimplement these selectors without a larger selector engine.

We think this trade-off is worth it. Keep in mind we will still support the positional methods, such as .first, .last, and .eq. Anything you can do with positional selectors, you can do with positional methods instead. They perform better anyway.

Upgrading

There should be no compatibility issues if upgrading from jQuery 3.0+. If you haven’t yet upgraded to jQuery 3+, please have a look at the 3.0 Upgrade Guide. The jQuery Migrate 3.0 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.

Download

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

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

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

You can also get this release from npm:

npm install jquery@3.4.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.4.0.slim.js

https://code.jquery.com/jquery-3.4.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 abnud1, Jason Bedard, buddh4, Kris Borchers, Andrei Fangli, Oleg Gaidarenko, Richard Gibson, Michal Golebiowski-Owczarek, Marja Hölttä, Dave Methvin, Ed S, Luis Emilio Velasco Sanchez, Saptak Sengupta, tmybr11, Bert Zhang, and the whole jQuery team.

Changelog

GitHub changelog: Issues fixed in 3.4.0 | All changes

Ajax

Core

  • Use isAttached to check for attachment of element (662083ed)
  • Tiny efficiency fix to jQuery.extend / jQuery.fn.extend (#4246) (#4245, 4ffb1df8)
  • Preserve CSP nonce on scripts with src attribute in DOM manipulation (#4323, 00504037)
  • Preserve CSP nonce on scripts in DOM manipulation (#3541, c7c2855e)
  • Support passing nonce through jQuery.globalEval (#4278, 5bdc85b8)
  • Recognize Shadow DOM in attachment checks (#3504, 9b77def5)
  • Prevent Object.prototype pollution for $.extend( true, … ) (753d591a)

CSS

  • Ensure camel- vs kebab-cased names are not collapsed for CSS vars (f8c1e902)
  • Avoid filling jQuery.cssProps (#3986, 2b5f5d5e)
  • Correctly detect scrollbox support with non-default zoom (#4029, 821bf343)
  • Don’t auto-append “px” to CSS variables (#4064) (#4063, 75b77b48)
  • Skip the px-appending logic for animations of non-element props (f5e36bd8)
  • Avoid forcing a reflow in width/height getters unless necessary (#4322, a0abd15b)
  • Don’t read styles.position in the width/height cssHook unless necessary (#4185, 354f6036)
  • Don’t auto-append “px” to possibly-unitless CSS grid properties (#4007, f997241f)

Dimensions

  • fix computing outerWidth on SVGs (#3964, e743cbd2)
  • avoid fetching boxSizing when setting width/height – this avoids forcing a reflow in some cases (#3991, 73d7e625)
  • fall back to offsetWidth/Height for border-box in IE (#4102, 315199c1)

Event

  • Prevent leverageNative from double-firing focusin (fe5f04de)
  • Add “code” property to Event object (#3978, 899c56f6)
  • Leverage native events for focus/blur/click; propagate additional data (#1741, #3423, #3751, #4139, 669f720e)
  • Respect script nomodule attribute in DOM manipulation (#4281, e4de8b46)
  • Restore _evalUrl jQuery.ajax calls to dataType: script (13de7c9e)
  • Only evaluate HTTP-successful script src (#4126, c2026b11)

Manipulation

  • Properly detect HTML elements with single-character names (#4124, 979809c5)

Misc

  • Add config for lockbot (2348f399)
  • Update license prolog/epilog to placate Github checker (29e76e25)

README

  • add gitter badge to README.md (7869f83d)
  • Add FOSSA license scan status badge (45f08588)

Selector

Serialize

  • jQuery.param: return empty string when given null/undefined (#2633, 0645099e)

Traversing

Internal

  • Seasonal update of uglify and its options (09684ba3)
  • Remove unnecessary ESLint exception (dc05f3c1)
  • Run the basic test suite in jsdom (0ec25abb)
  • Remove manual QUnit fixture resetting (84b6a0be)
  • Make Promises/A+ tests use the dot reporter instead of the default (ca9356ec)
  • Update QUnit from 1.23.1 to 2.9.2 (6ced2639)
  • Run Karma browser tests on Node.js 10 instead of 8 (16ad9889)
  • Update jsdom; migrate a test with Symbol polyfill to an iframe test (9cb124ed)
  • Remove obsolete globals from ESLint configuration (c10945d0)
  • Update most dependencies (8751e9ef)
  • Update test code for compatibility with QUnit 2.x (#4297) (c3498187)
  • Advise to create test cases on JS Bin or CodePen, drop JSFiddle (da44ff39)

jQuery 3.3.1 – fixed dependencies in release tag

Posted on by

We encountered an issue in the release for jQuery 3.3.0, so we’ve immediately released another tag. The code itself is identical, but our release dependencies (only used during release) were added to the dependencies of the jQuery package itself due to the new behavior of npm in version 5+.

jQuery 3.3.1 is now recommended if installing from npm or GitHub. If using jQuery on any CDN, the built file only differs in the version number.

We apologize for any inconvenience and have updated our release script to account for this issue.

Please see the jQuery 3.3.0 blog post for all relevant code changes in this release.

Download

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

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

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

You can also get this release from npm:

npm install jquery@3.3.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 all your 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 – 24k vs 30k. These files are also available in the npm package and on the CDN:

https://code.jquery.com/jquery-3.3.1.slim.js
https://code.jquery.com/jquery-3.3.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.

jQuery 3.3.0 – A fragrant bouquet of deprecations and…is that a new feature?

Posted on by

It’s been a while since the last jQuery release, but the Core team hasn’t been idle. We’ve got an all new minor release for you, and it’s even got a new feature in it!

The .addClass(), .removeClass(), and .toggleClass() methods now accept an array of classes.


jQuery(elem).addClass([
   'dave', 'michał', 
   'oleg', 'richard', 
   'jason', 'timmy'
]);

Generally, jQuery is not looking to add anything new. We tend to focus more on what we can remove rather than what we can add. But as soon as we saw this feature request, we wondered how it hadn’t been added before.

There should be no compatibility issues if upgrading from jQuery 3.0+. If you haven’t yet upgraded to jQuery 3+, please have a look at the 3.0 Upgrade Guide. The jQuery Migrate 3.0 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.

Deprecations

We’ve pruned some roses, lilies, and sunflowers in this release. Some of these will smell sweeter than others, but put them together, and you’ve got a beautiful bouquet of…depre-carnations.

These functions have either lost some of their usefulness over time, are considered to be less favorable than available alternatives, or were intended for internal usage from the beginning. While most of these will be removed in jQuery 4.0, it’s worth noting that we do not consider the deprecation of a method to mean that it will be removed; it means that we encourage the use of alternatives. For instance, event aliases like .click() will likely never be removed.

Command-line Testing

The magnificent Timo Tijhof has made it possible to run all jQuery tests on the command line, using grunt and karma. This is something we’ve always wanted but it was complicated by our need for a php server to run ajax tests. Thanks to Timo for making it happen!

Note: jQuery no longer runs any tests on PhantomJS 1.x.

Download

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

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

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

You can also get this release from npm:

npm install jquery@3.3.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 all your 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 – 24k vs 30k. These files are also available in the npm package and on the CDN:

https://code.jquery.com/jquery-3.3.0.slim.js
https://code.jquery.com/jquery-3.3.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 Andreas Solledar, Basil Belokon, Boom Lee, “CDAGaming”, Dave Methvin, Erik Lax, Henry Zhu, Jason Bedard, Jordan Beland, Matan Kotler-Berkowitz, Michał Gołębiowski-Owczarek, Nilton Cesar, Pierre Spring, Richard Gibson, Saptak Sengupta, Shashanka Nataraj, Steve Mao, Timo Tijhof, Faisal Irfan Yar Khan, and the whole jQuery team.

 

Changelog

GitHub changelog: Issues fixed in 3.3.0 | All changes

Ajax

  • Add an ontimeout handler to all requests (#3586, 262acc6f)
  • Don’t process non-string data property on no-entity-body requests (#3438, d7237896)

Attributes

  • Feature: Allow array param in add/remove/toggleClass (#3532, 80f57f8a)

Build

  • Test on Node.js 8, stop testing on Node.js 7 (bef46a2a)
  • Update to Babel 7, use for-of plugin instead of preset-es2015 (90bac40a)
  • Remove package-lock.json, add it to .gitignore (#3792, 7037facc)
  • Test on Node.js 9 (3e902a81)
  • Fix UglifyJS output in Android 4.0; update uglify (#3743, c9efd11f)

Core

CSS

  • Drop the float mapping from cssProps (bbf33428)
  • Correctly set support properties with non-default zoom (#3808, f00a0759)
  • Detect more WebKit styles erroneously reported as percentages (#3777, 94ddf620)
  • Retrieve inline style before computed (c4598da4)
  • Avoid unit-conversion interference from CSS upper bounds (#2144, 692f9d4d)

Deferred

Dimensions

Docs

  • Create CODE_OF_CONDUCT.md (e84d3bc0)
  • Update links to HTML spec for stripAndCollapse (#3594) (e1b1b2d7)

Event

Filter

Manipulation

  • Use `.children` to select tbody elements (a88b48ea)
  • Add support for scripts with module type (#3871, 5d3a968e)

Offset

Support

jQuery 3.2.1 Is Now Available, With Some Hotfixes

Posted on by

jQuery 3.2.1 is now available! This release comes with some hotfixes for regressions that were introduced in the 3.2.0 build four days ago. We wanted to release this patch as quickly as possible to squash any bugs you may have experienced when upgrading. The most significant one had to do with retrieving width or height on an inline element with no explicitly-set dimensions. This should now work as expected. A full list of changes is available below. Also see the 3.2.0 blog post for the bug fixes and improvements that still apply if upgrading from jQuery 3.1.1.

There should be no compatibility issues if upgrading from jQuery 3.0+. If you haven’t yet upgraded to jQuery 3+, please have a look at the 3.0 Upgrade Guide. The jQuery Migrate 3.0 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.

Changes

Core

  • Ensure jQuery.holdReady is in the right place (#3573, fcc9a9ec)

Dimensions

  • Ensure we get proper values for width and height on elements with display “inline” (#3571, 473d2ea7)

Event

  • Ensure trigger data is passed to radio click event handlers (#3579, a6b07052)
  • Revert: Trigger checkbox and radio click events identically (35785a32).
  • Revert: Add radio click triggering tests (4d6b4536).

GitHub changelog: Issues fixed in 3.2.1 | All changes

Download

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

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

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

You can also get this release from npm:

npm install jquery@3.2.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 all your 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 – 23.6k vs 30k. These files are also available in the npm package and on the CDN:

https://code.jquery.com/jquery-3.2.1.slim.js
https://code.jquery.com/jquery-3.2.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

Many thanks to all of you who participated in this release by testing, reporting bugs, or submitting patches, including Steve Mao and the whole jQuery team.

jQuery 3.2.0 Is Out!

Posted on by

jQuery 3.2.0 has been released!

This release includes some bug fixes, improvements, and some deprecations. There should be no compatibility issues if upgrading from jQuery 3.0+.

If you haven’t yet upgraded to jQuery 3+, please have a look at the 3.0 Upgrade Guide. The jQuery Migrate 3.0 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.

Notable Updates

  • Added support for custom CSS properties (#3144).
  • Deprecated jQuery.holdReady (#3288).
  • Deprecated jQuery.nodeName (#3475).
  • Deprecated jQuery.isArray (#2961).
  • Fixed a bug in .width(), .height(), and related methods where CSS transforms were included in the calculations. For instance, an element with the style transform: scale(2x) should not have its width and height values doubled (#3193).
  • Added support for <template> elements to the .contents() method (#3436).
  • Added back the deprecated module to the slim build. This change is largely insignificant given the module’s small size. We believe it makes more sense to remove deprecated pieces from the slim build at the same time as the main jQuery build (#3237).

Download

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

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

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

You can also get this release from npm:

npm install jquery@3.2.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 all your 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 – 23.6k vs 30k. These files are also available in the npm package and on the CDN:

https://code.jquery.com/jquery-3.2.0.slim.js
https://code.jquery.com/jquery-3.2.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

Many thanks to all of you who participated in this release by testing, reporting bugs, or submitting patches, including Connor Atherton, Jason Bedard, David Broder-Rodgers, Oleg Gaidarenko, Michał Gołębiowski, Richard Gibson, karan-96, Manoj Kumar, Alexander Lisianoi, Alex Louden, Alex Padilla, and the whole jQuery team.

GitHub changelog: Issues fixed in 3.2.0 | All changes

Full changelog

Callbacks

  • Prevent add() from unlocking with-memory lists (#3469, 9d822bc1)

Core

CSS

Deferred

  • Stop inventing jQuery.when() resolution values (#3442, 5d79c646)

Dimensions

  • Ignore transforms when retrieving width/height (#3193, c920ff6e)

Docs

  • Remove supported jQuery versions from ISSUE_TEMPLATE.md (fedc1aa6)
  • Correct typo in issue template (a8816caf)

Effects

Event

  • Trigger checkbox and radio click events identically (#3423, b442abac)
  • Add radio click triggering tests (5f35b5b4)

Manipulation

Offset

Tests

  • Skip CSS custom properties tests in non-supporting browsers (bcec54ee)
  • Update the loader so test pages always get jQuery (14b393d0)
  • Added tests for symbol-separated tag names (#2006, bd9145fa)
  • Clean up after the CSS Custom Properties support test (fc34dbc2)

Traversing

Build

  • Run tests on Node.js 7 (7bb62bb3)
  • Stop testing on Node.js 0.10 (5b4cb0d3)
  • jQuery Foundation -> JS Foundation (7fbab881)
  • Make the @CODE-replacing regex more robust (4e509677)
  • ESLint setup improvements (cbc8638c)
  • Drop jscs.json from .npmignore (b3e0a560)
  • Add most of the dist folder to .eslintignore (1754e315)
  • Use valid ecmaVersion (8cb4cd71)
  • Drop support for building on Node.js 0.12 (d10ac0e5)
  • Fix tests in AMD mode (56136897)
  • Fix markerPattern and ticketPattern regexes in package.json (25c6a0a2)
  • Keep deprecated module in slim (#3237, 0588d0ce)

jQuery 3.1.1 Released!

Posted on by

jQuery 3.1.1 is now available!

This release includes some bug fixes and improvements. As with all patch version releases, there are no new features or intended compatibility issues (if upgrading from jQuery 3.0+) in this release.

We fixed a selector issue with disabled options, exposed jQuery.noConflict even when jQuery is loaded with AMD, and fixed some issues concerning whitespace. We also fixed an issue with the map file that will help when using CDN copies during debugging.

If you haven’t yet upgraded to jQuery 3+, please have a look at the 3.0 Upgrade Guide. The jQuery Migrate 3.0 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.

GitHub changelog: Issues fixed in 3.1.1 | All changes

Download

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

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

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

You can also get this release from npm:

npm install jquery@3.1.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 all your 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. All in all, it excludes ajax, effects, and currently deprecated code. 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 – 23.6k vs 30k. These files are also available in the npm package and on the CDN:

https://code.jquery.com/jquery-3.1.1.slim.js
https://code.jquery.com/jquery-3.1.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

Many thanks to all of you who participated in this release by testing, reporting bugs, or submitting patches, including Oleg Gaidarenko, Michał Gołębiowski, Richard Gibson, Alexander Lisianoi, Steve Mao, Dave Methvin, and the whole jQuery team.

jQuery 3.1.0 Released – No More Silent Errors

Posted on by

Not so long ago, we released jQuery 3.0. One of the major features of jQuery 3.0 was a small rewrite of jQuery Deferreds. Specifically, we made them compatible with the Promises/A+ spec. That basically meant that errors had to be silenced and passed as rejection values to rejection handlers (added using deferred.catch()). This had the advantage of preventing Promise handlers from getting blocked up by runtime errors, but the disadvantage of errors being silenced if no rejection handlers were added. While this was the right move for Deferreds, we had also changed jQuery.ready and jQuery.fn.ready to use the new spec-compliant Deferreds under the covers.

Unfortunately, if you were using the usual ways to attach ready handlers (e.g. jQuery(function() {}) and jQuery(document).ready(function() {})), you had no way to add a rejection handler. Plus, it wasn’t obvious that you were in Deferred land. Any runtime exceptions were getting swallowed and lost in space. I think they ended up somewhere near Pluto, which isn’t even a planet anymore! There were workarounds, but this wasn’t acceptable to us.

We immediately set out to fix this, and thus jQuery 3.1.0 was born. No longer will errors be silent! You will see them logged to the console by default. If you’d like to have more control on how these errors are handled, we also added an entry point: jQuery.readyException. In most cases, you won’t need to use it, but any errors that are thrown within a ready handler will get passed to this function should you need it.

jQuery.readyException =
  function(error) {
    // "error" is thrown from
    // any ready handler
  };

The default jQuery.readyException will re-throw the error asynchronously, to avoid stopping execution and log the error to the console. We hope this solves any debugging issues you may have experienced when using jQuery 3.0.

We do not expect this release to have any breaking changes, but if you do encounter bugs in upgrading from the previous version, please let us know.

If you’d like help upgrading from jQuery 1.x or 2.x to jQuery 3.0, please check out the 3.0 Upgrade Guide and the jQuery Migrate 1.4.1 blog post.

3.1.0GitHub changelog

Download

You can include these files directly from the jQuery CDN if you like, or copy them to your own local server.

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

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 all your 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. All in all, it excludes ajax, effects, and currently deprecated code. 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 – 23.6k vs 30k. These files are also available in the npm package and on the CDN:

https://code.jquery.com/jquery-3.1.0.slim.js
https://code.jquery.com/jquery-3.1.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.

Many thanks to all of you who participated in this release by testing, reporting bugs, or submitting patches, including Oleg Gaidarenko, Micha? Go??biowski, and the whole jQuery team.