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

Deprecate jQuery.now (#2959, 909e0c99)

Deprecate jQuery.isWindow (#3629, c18d6085)

Make camelCase function available only for internal usage (#3384, 64a28928)

Deprecate jQuery.proxy (not slated for removal) (#2958, 3a8e4474)

Deprecate jQuery.type (#3605, 1ea092a5)

Deprecate jQuery.isNumeric (#2960, c4494d4a)

Update isFunction to handle unusual-@@toStringTag input (#3600, #3596, a16339b8)

Deprecate jQuery.isFunction (#3609, 3d732cca)

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

Fix memory leak of promise callbacks (#3606, 36389288)

Dimensions

Improve offsetWidth/offsetHeight fallback (#3698, #3602, a4957849)

Include scroll gutter in “padding” box (#3589, 80f1c823)

Fall back to offsetWidth/Height for inline elems (#3571, 473d2ea7)

Don’t trust non-pixel computed width/height (#3611, 3cf1d14c)

Detect and account for content-box dimension mishandling (#3699, 3fcddd6e)

Docs

Create CODE_OF_CONDUCT.md (e84d3bc0)

Update links to HTML spec for stripAndCollapse (#3594) (e1b1b2d7)

Event

Move event aliases to deprecated (#3214, 022b69a4)

`stopPropagation()` on native event-handler (#3693, 490db839)

Filter

Use direct filter in winnow (#3272, 4765bb5c)

Manipulation

Use `.children` to select tbody elements (a88b48ea)

Add support for scripts with module type (#3871, 5d3a968e)

Offset

Use correct offset parents; include all border/scroll values (#3080, #3107, 1d2df772)

Support