jQuery 3.0 and jQuery Compat 3.0 Alpha Versions Released

Posted on by

It’s been a long time since we did a major release, and you certainly deserve one. So we’re glad to announce the first alpha of jQuery 3.0!

Despite the 3.0 version number, we anticipate that these releases shouldn’t be too much trouble when it comes to upgrading existing code. Yes, there are a few breaking changes that justified the major version bump, but we’re hopeful these breakages don’t actually affect that many people. The jQuery Migrate plugin can help you to identify compatibility issues in your code as well. Your feedback on the changes in this alpha will help us greatly, so please try it out on your existing code and plugins!

There are actually two releases here. First is jQuery 3.0, which supports modern browsers and environments from IE9 forward. Second is jQuery Compat 3.0, which includes support for IE8. As an added bonus, both jQuery and jQuery Compat will include support for Yandex.Browser, a freeware browser released in 2012. You can get the files from the jQuery CDN, or link to them directly:

https://code.jquery.com/jquery-3.0.0-alpha1.js

https://code.jquery.com/jquery-compat-3.0.0-alpha1.js

You can also get the alpha versions from npm:

npm install jquery@3.0.0-alpha1

npm install jquery-compat@3.0.0-alpha1

 

Major changes

Below are just the highlights of the major new features, improvements, and bug fixes in these releases. A complete list of changes is available at the bottom of this post and on our GitHub issue tracker. On GitHub, you can additionally see the features we expect to put in later beta and final versions that have yet to land.

Simplified .show() and .hide() methods

Everyone’s mental model of jQuery’s .hide() method is that it sets display: none in CSS. Conversely, .show() clears the display so that the element shows again (assuming its parents are not hidden). Simple, right?

Well, no. There are actually many complex special cases that people asked us to “fix” over the years, which turned these methods into a convoluted confluence of principles. For example, what if the element is set to display: none in a stylesheet? jQuery would try to override that by forcing display: block on the element directly. Okay, but what if a normally block element like <li> was set to display: inline by a different stylesheet rule? How about the case where you call these methods on an element before it’s been added to the document and we don’t know what display value it will have? Determining all of that takes extra work. Sometimes it’s still just a guess that turns out to be wrong.

Since these methods add a style attribute to the element, they don’t tend to play well with techniques like responsive design where the visibility of elements may also be set by media queries. This leads to the need for jQuery handlers that listen for the orientationchange or resize events and manually hide or show parts of the page; it defeats the elegant solution that media queries were trying to implement.

You can see that jQuery was already about halfway down the path to total madness, and it didn’t make sense to complete the journey. The special cases and checks were not only complex and incomplete, but they caused significant performance issues on large pages.

So, instead, we’re experimentally defying the evolution of these methods and reverting to a simple, primordial model. This will break some code. If you have elements in a stylesheet that are set to display: none, the .show() method will no longer override that. So the most important rule for moving to jQuery 3.0 is this: Don’t use a stylesheet to set the default of display: none and then try to use .show() – or any method that shows elements, such as .slideDown() and .fadeIn() – to make it visible.

If you need an element to be hidden by default, the best way is to add a class name like “hidden” to the element and define that class to be display: none in a stylesheet. Then you can add or remove that class using jQuery’s .addClass() and .removeClass() methods to control visibility. Alternately, you can have a .ready() handler call .hide() on the elements before they are displayed on the page. Or, if you really must retain the stylesheet default, you can use .css("display", "block") (or the appropriate display value) to override the stylesheet.

We know that this is likely to be one of the most contentious and difficult changes in jQuery 3.0, so we wanted to put it out in this early release to see the effects. Please let us know how it affects your code and what you need to change in order to work with this new model.

https://github.com/jquery/jquery/issues/1767
https://github.com/jquery/jquery/issues/2057
https://github.com/jquery/jquery/issues/2308

Special case with .data() names

We have updated our .data() implementation to closer match the HTML5 dataset specification. All keys are now converted from kebab-case to camelCase, regardless of access method, and digits no longer participate in the conversion. For example, we will no longer differentiate between “foo-bar” and “fooBar”, but will differentiate between “foo-42” and “foo42”. These changes will mainly come into play when retrieving all data by calling .data() with no arguments, or when trying to access the data using a converted key (.data(“foo42”)) instead of the original (.data(“foo-42”)).

https://github.com/jquery/jquery/issues/1751

jQuery.Deferred is now Promises/A+ compatible

jQuery.Deferred objects have been updated for compatibility with Promises/A+ and ES2015 Promises, verified with the Promises/A+ Compliance Test Suite. This meant the introduction of a .catch() method and some major changes to the .then() method:

  • An exception thrown in a .then() callback now becomes a rejection value. Previously, exceptions bubbled all the way up, aborting callback execution and irreversibly locking both the parent and child Deferred objects.
  • The resolution state of a Deferred created by .then() is now controlled by its callbacks—exceptions become rejection values and non-thenable returns become fulfillment values. Previously, returns from rejection handlers became rejection values.
  • Callbacks are always invoked asynchronously. Previously, they would be called immediately upon binding or resolution, whichever came last.
  • Progress callbacks can no longer resolve Deferred objects to which they are bound.

Consider the following, in which a parent Deferred is rejected and a child callback generates an exception:

var parent = jQuery.Deferred();
var child = parent.then( null, function() {
  return "bar";
});
var callback = function( state ) {
  return function( value ) {
    console.log( state, value );
    throw new Error( "baz" );
  };
};
var grandchildren = [
  child.then( callback( "fulfilled" ), callback( "rejected" ) ),
  child.then( callback( "fulfilled" ), callback( "rejected" ) )
];
parent.reject( "foo" );
console.log( "parent resolved" );

As of jQuery 3.0, this will log “parent resolved” before invoking any callback, each child callback will then log “fulfilled bar”, and the grandchildren will be rejected with Error “baz”. In previous versions, this would log “rejected bar” (the child Deferred having been rejected instead of fulfilled) once and then immediately terminate with uncaught Error “baz” (“parent resolved” not being logged and the grandchildren remaining unresolved).

While caught exceptions had advantages for in-browser debugging, it is far more declarative (i.e. explicit) to handle them with rejection callbacks. Keep in mind that this places the responsibility on you to always add at least one rejection callback when working with promises. Otherwise, any errors will go unnoticed.

Legacy behavior can be recovered by replacing use of .then() with the now-deprecated .pipe() method (which has an identical signature).

jQuery.when has also been updated to accept any thenable object, which includes native Promise objects.

https://github.com/jquery/jquery/issues/1722
https://github.com/jquery/jquery/issues/2102

Removed special-case Deferred methods in jQuery.ajax

jqXHR object is a Promise, but also has extra methods like .abort() so that you can stop a request after it has been made.

As users increasingly embrace the Promise pattern for asynchronous work like AJAX, the idea of having special cases for the Promise returned by jQuery.ajax is an increasingly bad idea.

success, error, complete
done, fail, always

Note that this does not have any impact at all on the callbacks of the same name, which continue to exist and are not deprecated. This only affects the Promise methods!

https://github.com/jquery/jquery/issues/2084

Error cases don’t silently fail

Perhaps in a profound moment you’ve wondered, “What is the offset of a window?” Then you probably realized that is a crazy question – how can a window even have an offset?

In the past, jQuery has sometimes tried to make cases like this return something rather than having them throw errors. In this particular case of asking for the offset of a window, the answer up to now has been { top: 0, left: 0 } With this alpha of jQuery 3.0 we’re experimenting with the idea of having such cases throw errors so that crazy requests aren’t silently ignored. Please try the alpha and see if there is any code out there depending on jQuery to mask problems with invalid inputs.

https://github.com/jquery/jquery/issues/1784

.width(), .height(), .css(“width”), and .css(“height”) to return decimal values (whenever the browser does)

Previously, jQuery rounded values when retrieving width and height. Some browsers return subpixel values – such as IE and Firefox – and sometimes users need this precision when relying on these values for layout. We don’t expect this change to have a big impact on your code, but let us know if it does.

https://github.com/jquery/jquery/issues/1724

Removed deprecated event aliases

.load, .unload, and .error, deprecated since jQuery 1.8, are no more. Use .on() to register listeners.

https://github.com/jquery/jquery/issues/2286

jQuery.swap, jQuery.buildFragment, and jQuery.domManip are no longer accessible on the jQuery object

These methods were always intended for internal use only and were never documented. We are finally making them private to avoid confusion.

https://github.com/jquery/jquery/issues/2224
https://github.com/jquery/jquery/issues/2225

Animations now use requestAnimationFrame

On platforms that support the requestAnimationFrame API, which is pretty much everywhere but IE8 and IE9, jQuery will now use that API when performing animations. This should result in animations that are smoother and use less CPU time – and save battery as well on mobile devices.

jQuery tried using requestAnimationFrame a few years back but there were serious compatibility issues with existing code so we had to back it out. We think we’ve beaten most of those issues by suspending animations while a browser tab is out of view. Still, any code that depends on animations to always run in nearly real-time is making an unrealistic assumption.

.unwrap( selector )

Before jQuery 3.0, the .unwrap() method did not take any arguments. The selector parameter offers a way to be specific about which wrappers to remove.

https://github.com/jquery/jquery/issues/1744

Massive speedups for some jQuery custom selectors

Thanks to some detective work by Paul Irish at Google, we identified some cases where we could skip a bunch of extra work when custom selectors like :visible are used many times in the same document. That particular case is up to 17 times faster now!

Keep in mind that even with this improvement, selectors like :visible and :hidden can be expensive because they depend on the browser to determine whether elements are actually displaying on the page. That may require, in the worst case, a complete recalculation of CSS styles and page layout! While we don’t discourage their use in most cases, we recommend testing your pages to determine if these selectors are causing performance issues.

https://github.com/jquery/jquery/issues/2042

 

Thanks

Many thanks to all of you who participated in this release by testing, reporting bugs, or submitting patches, including Chris Antaki, Jason Bedard, Leonardo Braga, Bastian Buchholz, Anne-Gaelle Colom, David Corbacho, Brenard Cubacub, Hamish Dickson, Ben Edelman, Stephen Edgar, elas7, flexphperia, Corey Frang, Xue Fuqiao, Oleg Gaidarenko, Richard Gibson, Michał Gołębiowski, Scott González, goob, Veaceslav Grimalschi, Mu Haibao, Dan Hart, Frederic Hemberger, Nicolas Henry, Daniel Herman, Jon Hester, Victor Homyakov, Winston Howes, Daniel Husar, Essam Al Joubori, Veres Lajos, George Mauer, Richard McDaniel, Amit Merchant, Calvin Metcalf, Dave Methvin, MightyBranch, Nazar Mokrynskyi, Matthew Mueller, Martin Naumann, Alexander O’Mara, Randson Oliveira, Gilad Peleg, James Pearce, PJ, Senya Pugach, Aditya Raghavan, Chris Rebert, Aurelio De Rosa, Gabriel Schulhof, Mike Sidorov, Nick Stefan, Arthur Stolyar, Timo Tijhof, Ben Toews, Thomas Tortorini, Shivaji Varma, Arthur Verschaeve, Rick Waldron, Bin Xin, Imran M Yousuf, Jörn Zaefferer.

 

Changes

Here is the full list of changes since the last official releases (1.11.3 and 2.1.4):

 

Common to both jQuery and jQuery Compat

Ajax

  • Always use script injection in globalEval (#14757, bbdfbb4)
  • Remove jsonp callbacks through “jQuery#removeProp” method (#2323, a2ae215)
  • remove event dependency from the ajax module (4e7f34f)
  • Fix for request aborted in ajaxSend (#1775, 598ed05)
  • use anchor tag for parsing urls (#1875, b091fdb)
  • Fix cross-domain detection test for non-default port (83b038f)
  • $.post and $.get can now take an options object (#1986, 89ce0af)
  • simplify one ajax call and add explanatory comment (0ac28ed)
  • make jQuery#load “type” field explicit (4ef120d)
  • replace “jqXHR.complete” callback with “always” (97ef1f2)
  • remove deprecated extensions from ajax promise (#2084, 9d1b989)
  • remove use of jQuery#each second argument (a4715f4)
  • remove “onunload” event handler (a117dd0)
  • Remove remnants of the load event alias handling (38a6697)

Attributes

  • add SVG class manipulation (#2199, 20aaed3)
  • return null when attribute does not exist (#2118, aaeed53)
  • Use the option val hook in select val hook and simplify it (#1902, f6302b0)
  • remove unnecessary element null check (55ac56a)
  • fix failing test for new return value (5dc4616)
  • revert returning null for non-elements (7632b74)
  • revert returning null for non-existant attributes (2905961)

Build

  • update Sizzle to 2.0.0 (bcca4f0)
  • Update grunt-contrib-jshint (1556c46)
  • remove bower.json lint target (285cfbf)
  • add mailmap entry (3ec73ef)
  • Update the license attribute (#2331, 8e92e1e)
  • drop bower; use npm for front-end deps (#15186, e1949f4)
  • update front-end dependencies (8356948)
  • update node dependencies barring jscs (8e3a0ce)
  • update grunt-jscs-checker and pass with the new rules (c869a1e)
  • update requirejs dependency to 2.1.17 (#2290, a644101)
  • update source map options for the new grunt jshint (269a27c)
  • bower.json: remove moot `version` field (61e21a4)
  • fix broken assertions caused by QUnit update (8b6aeae)
  • Update commitplease dev dependency (39b7606)
  • remove deprecated JSHint options (34da7d5)
  • update AUTHORS.txt (8f13997)
  • Upgrade to commitplease 2.0.0 (5bc1ddc)
  • Update QUnit to latest (1.17.1) (2d5c5d2)
  • update version to 3.0.0-pre (7a607c5)
  • Move test to appropriate module (fbdbb6f)
  • Fix various typos (dc4b914)
  • Speed up the Travis build (31f4f8e)
  • Remove empty define({}) from build output (#1768, 2c1b556)
  • Remove npm from dependencies (b92acf7)
  • Upgrade to grunt-bowercopy 1.0.0 (323e82c)
  • Remove unused Sizzle test files (8d11310)
  • fix tests in AMD mode (6051609)
  • Move all external libraries to external directory (c5d9d88)
  • account for version labels in Sizzle versions (#1939, 78ac753)
  • update node dependencies (9101704)
  • Sizzle version labels must start with a dash (d6c97ab)
  • Don’t assume the browser environment; smoke test on Node w/ jsdom (#1950, 76df9e4)
  • Remove dates from copyright notice (66e1b6b)
  • Specify valid components for commit messages (0c9d018)
  • ignore test dependencies for npm install (35f8e15)
  • update Sizzle to 1.11.1 and include license (c0b23e2)
  • update Sizzle (#2042, #1969, 3a0dd5a)
  • update grunt-bowercopy (712e78c)
  • Update license (4f776e5)
  • Sanctify the component name status of Wrap (a4133ff)
  • Update native-promise-only (again) (f5aa89a)
  • Rearrange grunt/npm tasks into a build/dist/test pattern (bb928bd)
  • Update native-promise-only (0065e1f)
  • save sinon update for later (#2160, 98c25b7)

Callbacks

Core

  • Return empty array instead of null for parseHTML(“”) (#1997, 4116914)
  • use document.implemenation.createHTMLDocument in jQuery.parseHTML (58c2460)
  • Follow the AMD specification for define (892625b)
  • Throw an error on $(“#”) rather than returning 0-length collection (80022c8)
  • allow init to accept an alternate rootjQuery for migrate’s sake (#2101, 7a6931d)
  • remove unnecessary support test for createHTMLDocument (5923282)
  • pass empty string to createHTMLDocument to appease IE (31c7d7f)
  • revert addition of createHTMLDocument. Thanks, Safari 8. (b779831)
  • Update tested jsdom, drop obsolete workarounds (#2153, 06f6cd1)
  • re-introduce createHTMLDocument in parseHTML; Safari 8 left out (cfe468f)
  • Standardize indexOf comparisons (53aa87f)
  • remove custom ready event (#2264, c252c5f)
  • Consistently use local reference to access() (2fb719e)
  • Remove deprecated context and selector properties (#1908, 0ea8c32)
  • remove isArraylike check for nodes (#2238, 436f0ae)
  • add support to tag-hyphenated elements (534f130)
  • Use window.setTimeout & friends instead of global equivalents (#2177, 219c749)
  • Drop size and andSelf methods (#1749, f110360)
  • Drop strundefined variable (29838b6)
  • Make jQuery objects iterable (#1693, bb026fc)
  • add workaround for iOS JIT error in isArrayLike (#2145, 1541664)
  • Test all factory use cases from intro.js (#2181, ab40725)
  • Switch from modules to just window.setTimeout etc. (842958e)
  • Align branches: remove an unused variable, add comments (f6de5a9)
  • simplify “each” stylesheet iteration test (fcb6c4d)
  • Simplify and speed up .each (eeda11c)
  • organize prop & attr code to be similar (5153b53)
  • change jQuery.each and jQuery#each signatures (#2090, 2380028)

CSS

  • CSS:Event: simplification of native method signatures (85577a3)
  • Fix the “sanity check” test (995f707)
  • Remove non-functional unit test for negative margin (4ab7431)
  • Add an integration test for issue gh-1764 (8887106)
  • Remove use of getDefaultComputedStyle (#15227, 274feb5)
  • Use pre-defined displays for html and body (a772418)
  • Correct typo in the comment (7e09619)
  • Removed redundant “to the number” in comment (895ea68)
  • fix :visible/:hidden selectors for inline element w/ content (#2227, 79bcb29)
  • Support relative adjustment in any applicable unit (#1711, 9b03f6d)
  • elements are hidden when either offsetWidth or offsetHeight is zero (#10406, #13132, 10399dd)
  • Ignore the CSS cascade in show()/hide()/etc. (#1767, #2071, 86419b1)
  • Fix the pixelMarginRight support test in Android 2.3 (cdfc2d0)
  • Clean up memory leak in reliableMarginRight (#1795, 7d15b4d)
  • Don’t cache unrecognized CSS property names (#2015, d471842)
  • Don’t name the anonymous swap function (0019a46)
  • make the getStyles function more readable (3a0d582)
  • Work around an IE11 fullscreen dimensions bug (#1764, 90d828b)
  • Add unit tests for negative margins and positioning (1b932bb)
  • simplify “defaultDisplay” module (c62486f)
  • Make .css(“width”) & .css(“height”) return fractional values (#1724, b60b26e)
  • Don’t expose jQuery.swap (#2058, bb4d888)
  • Improve a comment explaining IE11 fullscreen bug (8e4aac8)

Data

  • do not include digits when camelCasing (#1751, 2862a07)
  • always camelCase keys in .data() (#2257, 0e79098)
  • Use a PDF object instead of a Java applet for acceptData testing (#1938, 087d280)
  • camelCasing should not ignore case (#2070, 172cad8)

Deferred

Dimensions

  • allow modification of coordinates argument (#1848, f7e60dc)

Docs

  • 1.x-master branch -> compat branch; 2.x branch -> master branch (758fd6c)
  • correct grunt command in README.md (#1850, 9d6beac)
  • remove redundant instruction from the readme (#2359, 3c92770)
  • Clarify custom build instructions (a3779bc)

Effects

  • Adding unit tests for jQuery.Animation (b3b2d6c)
  • Reintroduce use of requestAnimationFrame (#15147, 72119e0)
  • add tests for jQuery.easing._default in Animation and Tween (6d7ef56)
  • set default easing using jQuery.easing._default (#2219, 5f2ea40)
  • Add tests for jQuery.Tween (cdaed15)
  • Improve raf logic (708764f)

Events

  • remove preDispatch hook & simplify “simulate” signature (3655c4e)
  • remove guard for falsy handler argument of jQuery#on method (fac67a9)
  • add support comment (9db9316)
  • correct support comment (361a0d5)
  • HTML5 drop events inherit from MouseEvent (#2009, d7e5fce)
  • Fully clean up events in unit test (4467ed6)
  • Empty namespaces should be uneventfully ignored (8653068)
  • remove outdated originalEvent hack (6df669f)
  • Remove fake originalEvent from jQuery.Event.simulate (#2300, 7475d5d)
  • fix incorrect window bug with scrollTop/Left in iframes (#1945, d21edb5)
  • remove deprecated event aliases (#2286, 0705be4)
  • Add a note about a mouseenter bug in Chrome (a5e1c9b)
  • Restore the `constructor` property on jQuery.Event prototype (#15090, b807aed)
  • Copy detail property to jQuery.Event on native events (#1867, d9ed166)
  • Remove an internal argument to the on method (04a2969)
  • Normalize mouse event properties in drag events (#1925, 97cf528)
  • provide verbose comment for focus(in | out) & rename support prop (c074006)
  • remove redundant guards for the event methods (#2047, a873558)

Manipulation

Misc

  • Drop support for older browsers; update support comments (740e190)
  • Need for speed removed by 9ad6e7e (ff928f5)
  • Mac OS is now OS X, thanks @xfq (d30c482)

Offset

  • remove ownerDocument check in offset getter (#2115, 6176567)
  • Round offset value for the sake of floating errors (#2147, 62ae2d0)
  • return zeros for disconnected/hidden elements (#2310, 40dcc76)
  • Fix .offset() to correctly work with ShadowDOM (#1784, 1617479)
  • account for scroll when calculating position (#1708, 2d71594)
  • don’t run scrollTop/scrollLeft iframe test in Android 2.3 & 4.0 (#1981, 0c46643)
  • return before getBoundingClientRect to avoid error in IE8-11 (0e4477c)
  • add tests for hidden elements + scroll (b041242)
  • simplify jQuery#offsetParent method (74ae544)

README

  • Fix punctuation in tile (df62159)
  • Fix minor style issues. Thanks @MightyBranch! (edfc94d)
  • update the Homebrew site address (b410b15)
  • various text fixes (31b63fc)
  • Update the description of the deprecated module (1d75273)
  • Improve build instructions (2e9c1ea)

Release

  • update AUTHORS.txt (e905dcd)
  • Remove copying of jquery-latest files (c34ed46)
  • properly set the dist remote when it’s a real release (c44dd77)
  • bower.json is actually generated from scratch (61224f5)
  • Distribute files to distribution repo (#1869, #1673, #2045, 26eca14)
  • dist can be run during a test (aae998b)
  • push dist to same remote as project (1ba45fc)
  • remove sourcemap comment from all copies of minified file (#1707, a76c781)
  • fix CDN archive creation (#1940, e0673df)

Selector/Sizzle

  • add jQuery.uniqueSort; deprecate jQuery.unique (#2228, e1090c3)
  • add test for jQuery.unique() alias (add85af)
  • Remove “#” exception for identifier tokens (86e62d8)
  • update to 2.1.1 (7602dc7)

Support

  • Re-organize browser order, add Safari 8 (43faf6d)
  • Correct iOS 8 support test results, re-arrange entries (ce308e2)

Tests

  • Update QUnit (6748ba3)
  • Minor updates for QUnit 1.16 compatibility (26276a3)
  • Accommodate page changes from the QUnit HTML reporter (3c13f4c)
  • Increase QUnit timeout (ff18d8e)
  • Tilt at a few style guide windmills (906caeb)
  • Correct a typo in the regex matching Safari 8 (c17543f)
  • Add Microsoft Edge results (from Windows 10 build 10130) (8e111df)
  • Remove Edge version from the user agent (5a1217e)
  • Remove test/data/ua.txt (#2398, e831856)
  • fix tests in accordance with new :visible behavior (16713fb)
  • add the current version of node and iojs to the travis config (bd9a138)
  • Expand CSS relative adjustment tolerance for IE (e22ef5d)
  • Fix CSS relative adjustment test for round-down browsers (48be675)
  • Lower the checks rounding error (a44cfa0)
  • make top of the HTML suite compliant with style guide (8356281)

Wrap

  • Support .unwrap( selector) for selective unwrapping (#1744, 7b09235)

 

jQuery 3.0 Only

Ajax

  • Remove workaround for IE6/7 (e519098)
  • simplify jQuery.parseXML method (5a0867d)

Build

  • use different versions of jsdom for Node and iojs testing (#2266, 5c3101f)
  • Refactor Node smoke tests (9c8a3ec)
  • Moved JSHint directives to .jshintrc file (15a609f)

CSS

  • save 20 bytes in css/support (45ec73f)
  • Collapse a double if statement into one (7855a1a)
  • Restore the hack to get pixels for .css(‘width’) etc. (3747cc6)

Data

  • shave off a couple of bytes (6f65f5f)
  • avoid Object.defineProperties for nodes (#1728, 95fb798)
  • avoid non-alphanumeric chars in expando properties (0cdec79)
  • updates to element[expando] cache (222ac3a)
  • move element cache to element[expando] (#1734, d702b76)
  • remove some unused code (764dc94)
  • remove the expando when there’s no more data (#1760, 56bb677)
  • speed up $.fn.data() for camel-cased key (#1941, 72c4a06)
  • restore explicit data removal of private data in cleanData. (#2127, 332fd94)
  • Drop the tests relying on applets (#1938, 95c0a10)

Docs

  • Add info about Sizzle not being excludable on the compat branch (#2184, 062b526)
  • Fix README uppercase (b50e0f2)

Manipulation

  • Tolerate XMLNode host object input to getAll (#15151, 1ae025e)
  • Check state lost if the name is set for Android 4.0-4.3 (1bbb678)

Misc

  • Adjust comments & docs to dropping IE * Misc: Update all references to bugs.jquery.com (#1681, 3e89a53)
  • Remove leftover -moz-box-sizing in tests (e81b258)

Offset

  • Simplified a conditional (4287442)
  • don’t run scrollTop/scrollLeft iframe test in mobile Safari (4ab8603)

README

  • Add selector-native.js link. Thanks @randsonjs! (cfe2eae)

Tests

  • Remove a trailing comma for compatibility with the compat branch (dc8ba6a)

 

jQuery Compat 3.0 only

Ajax

  • Add support comment and fix code style issue (e38a94a)
  • Run the PATCH test only in IE8 on TestSwarm (#1994, 2524da0)
  • move explanatory comment to appropriate place (04fc801)
  • Use the native XHR for all non-local requests in IE9+ (#1684, 61f812b)
  • Rename Spartan to Edge in a comment (8d88cd5)
  • Fix the XHR fallback logic for IE8 (bd699cb)

Attributes

  • Use typeof check for getAttribute method (075da30)
  • don’t test SVG CSS-class manipulation in IE8 (57fb2dc)
  • fix IE8 issues (f2bcf87)

Build

  • Point to files from the compat branch, not master (b7663ea)
  • Put “jQuery Compat” in banners in built files (8cd6875)
  • 1.x-master -> compat (2912ddd)
  • Add “timers_ie.js” file back to the repo (31e6697)
  • append “+compat” to tag version and jQuery.fn.jquery (#2269, d18b645)
  • Correct indentation issue (d0f27a7)

Callbacks

  • Change broken url to wayback one (e4cbc97)

Core

  • Align code in intro.js with master (fe2a584)

CSS

  • Add a support test for the hack for .css(‘marginRight’) etc. (25bc680)
  • Fix get upper case alpha opacity in IE8 (#1705, c5e8e12)
  • simplify hack of css getter for the computed values (dac716c)
  • fix dependency order for amd (e185aa3)

Data

  • use removeAttribute in cleanData to bypass Chrome bug (#1664, 9d1d90e)

Deferred

  • pass lint in new catch tests (203979d)

Docs

Effects

Events

  • Add reference to data module (2866da9)
  • correct an unfinished comment (ac23f91)

Manipulation

  • don’t test data-URI with script element in IE8 (503e545)
  • Plug an IE8 memory leak in noCloneEvent feature detect (#1840, faf295a)
  • Update html5shiv elements (#15241, a953389)
  • blacklist IE8 from running tests for tag-hyphenated elems (87bb713)

Misc

Offset

  • allow offset setter to throw for disconnected elements (#2114, dc49f62)
  • getBounding doesn’t return width/height in IE8. Fixes test. (3b1de11)
  • fix iframe scrollTop/Left test for IE8 (d632699)
  • fix iframe scrollTop/Left test for IE8 and iPhone (62a333e)
  • revert to jQuery.contains for IE8’s sake (compat only) (6df3990)
  • no need to check for ownerDocument (523de77)

Tests

  • Restore IE8 workarounds (Sinon timers for IE & HTML5 shiv) (0b07c65)

Traversing

  • simplify jQuery#contents method (7230df1)

17 thoughts on “jQuery 3.0 and jQuery Compat 3.0 Alpha Versions Released

  1. How do I animate removeClass? Changing show/hide like that you seem to have just removed support for whole bunch of functions that are used for all kinds of toggled animations.

    Correct me if I’m wrong, but that includes braking your accordion, dialog and all a like from both jQuery UI and jQuery Mobile.

  2. Wyatt on said:

    So this breaks jQuery UI? Will there be a compatible version of jQuery UI released soon?

  3. Why not advocate the use of HTML’s [hidden] attribute and have show()/hide() toggle that instead? Telling folks to define a CSS class, use ready(), or set inline styles with css() sounds like lots of work to simply show and hide elements.

    To me, the [hidden] attribute is how elements should be hidden, and I feel that’s really what show()/hide() should be changing.

  4. To me, the .show() and .hide() changes don’t make much sense from a programming point of view. And while for sure that change was debated and thought through, I think it will cause more confusion than anything. I can see how the change works for edge cases but for most cases, if I write $(‘#TheElement’).show() then I’d expect this to show the element. Take a look at this jsFiddle for a demo of the change: http://jsfiddle.net/mrf9j6Lj/ It seems like it’s asking developers to handle the most common case (hide or show the element with one function call) like it’s an edge case. If someone has an edge case then I think they should be the one handling the complexity of that edge case.

  5. Lorem on said:

    You got me on Promises/A+ and animations using the requestAnimationFrame feature.

    If you’re about to modernize $.animate, could you also make sure, that you don’t thrash the layout while animating? More info in this wonderful article: http://davidwalsh.name/css-js-animation

  6. Anthony on said:

    I’d rather you guys make some breaking changes one of these major versions to support the same native signatures for each and likewise methods.

  7. Jedd on said:

    Dude. About time! jQuery Promises will finally make sense – that’s amazing. requestAnimationFrame is a good change, but I think (or, I’d love to think) that we’ve all moved on to CSS-based animations for most of our use cases.

    As for the show/hide – I support this decision. Don’t go back on it.

  8. staaky on said:

    Awesome! The changes to show() and hide() should be a nice performance boost.

  9. Drew on said:

    +1 for making the move away from a way-too complex .show/.hide.

    +1 for lazd’s interpretation of why [hidden] is a possible appropriate replacement for an inline display:none; (it has the advantages of being like a native css class for hiding but one which you can then extend for specific use cases/extra override specificity if ever needed… and all without directly changing/reading inline styles).

    Imho, hide should add that attribute, show should remove it, and if it’s not there, but something else in the css was hiding it, tough. Fix your css and be specific about what you intend to happen in any given context. .show should never have tried to override/beat css in the first place. Yeah, .slideDown used to be the simple way to toggle things open and closed, and no css animations aren’t quite an ideal replacement (animating max-height, ugh). But in a world with media-queries and reflows to think about, nothing _should_ be that simple/one-size fits all.

  10. gpgekko on said:

    I’d almost start crying from happiness :D Finally jQuery is doing a sanity check on itself and shedding some of the hidden complexity it picked up over the years. I’ve had many a fight with hide and show, so I can only applaud those changes. However, I do think the [hidden] attribute should get a more prominent role in all of this.
    No longer returning bogus information, using requestAnimationFrame and ditching old methods, this release is worthy of a major version bump (and was so overdue).

  11. With version 2, jQuery stopped supporting older browsers and we hoped to have a much smaller and leaner jQuery. That was not really the case because Android 2.x was still supported. Will support for Android 2.x be dropped now so jQuery can finally get rid of its obsoleted code?

  12. Tristan Lostrah on said:

    Intrigued to hear about the show()/hide() changes. While I have no problem with the changes, there does need to be a way to default something as hidden. If styles aren’t appropriate then it needs to be an attribute or data value.

    Using the hidden attribute makes some sense in this case.