📜 ⬆️ ⬇️

JQuery 1.5 was released

jQuery 1.5 is ready to use!

This long-awaited release forced a lot of effort from the development team . Therefore, a huge thank you to them!

Loading


As a rule, there are two options for using jQuery - minimized and unpacked (for debugging and learning).


You can freely use these URLs directly in your project, thereby obtaining all the performance benefits due to fast jQuery loading.
')
You can also download jQuery from Microsoft and Google's CDNs:

About release


In this release, 83 errors and 460 closed tickets in total were corrected.

The test suite (which now includes 4437 tests) runs successfully in all browsers that run jQuery. The development team assures that the tests are successful in the following browsers:


Link to the news on the offsite: http://blog.jquery.com/2011/01/31/jquery-15-released/

API documentation can traditionally be found at: jQuery 1.5 API Documentation .

A full schedule of upcoming issues can be found at the link . Now the team is planning to release major versions of jQuery more often than before (let's say, several times a year against the early plan - 1 per year).

So, without further ado, what's new in jQuery 1.5?


Ajax Complete Recycling

The biggest change in this release is the reworking of the Ajax module. This allows you to fix the many holes that occurred in the old version of this module, while ensuring a high level of consistency from the API interface.

Perhaps the biggest change concerns the jQuery.ajax call (or jQuery.get, jQuery.post, etc.). Now the result of executing this method returns a jXHR object that provides consistency with the XMLHttpRequest object between different platforms (which now allows you to perform previously impossible tasks due to the interruption of JSONP requests).

More information on the new jXHR object can be found in the jQuery.ajax () documentation .

As a complement to a more consistent API, the Ajax system is also now more extensible, allowing you to attach various kinds of processing, filters, and transports. These changes should provide the basis for a new generation of Ajax plugins, interacting with the new implementation. More information can be found in the Ajax extension documentation .
The team is actively working on the extensibility of the Ajax API and if you have something to say, please feel free to contact the jQuery developer forum

Deffered objects

Along with the reworked Ajax module, a new feature has also become available, the so-called “Deferred Objects” (made, by the way, on the basis of Promisess / A , approx. Transl.) . This API allows you to work with the resulting data set, which actually does not yet exist (for example, the result of an asynchronous Ajax request). This additionally provides the ability to attach multiple event handlers (which was previously not possible in the previous Ajax API).

For example, the following operations are now possible with the new jQuery Ajax API:

  1. // , // jxhr- var jxhr = $.ajax({ url: "example.php" }) .success( function () { alert( "" ); }) .error( function () { alert( "" ); }) .complete( function () { alert( "" ); }); // - ... // complete jxhr.complete( function (){ alert( " " ); });
  2. // , // jxhr- var jxhr = $.ajax({ url: "example.php" }) .success( function () { alert( "" ); }) .error( function () { alert( "" ); }) .complete( function () { alert( "" ); }); // - ... // complete jxhr.complete( function (){ alert( " " ); });
  3. // , // jxhr- var jxhr = $.ajax({ url: "example.php" }) .success( function () { alert( "" ); }) .error( function () { alert( "" ); }) .complete( function () { alert( "" ); }); // - ... // complete jxhr.complete( function (){ alert( " " ); });
  4. // , // jxhr- var jxhr = $.ajax({ url: "example.php" }) .success( function () { alert( "" ); }) .error( function () { alert( "" ); }) .complete( function () { alert( "" ); }); // - ... // complete jxhr.complete( function (){ alert( " " ); });
  5. // , // jxhr- var jxhr = $.ajax({ url: "example.php" }) .success( function () { alert( "" ); }) .error( function () { alert( "" ); }) .complete( function () { alert( "" ); }); // - ... // complete jxhr.complete( function (){ alert( " " ); });
  6. // , // jxhr- var jxhr = $.ajax({ url: "example.php" }) .success( function () { alert( "" ); }) .error( function () { alert( "" ); }) .complete( function () { alert( "" ); }); // - ... // complete jxhr.complete( function (){ alert( " " ); });
  7. // , // jxhr- var jxhr = $.ajax({ url: "example.php" }) .success( function () { alert( "" ); }) .error( function () { alert( "" ); }) .complete( function () { alert( "" ); }); // - ... // complete jxhr.complete( function (){ alert( " " ); });
  8. // , // jxhr- var jxhr = $.ajax({ url: "example.php" }) .success( function () { alert( "" ); }) .error( function () { alert( "" ); }) .complete( function () { alert( "" ); }); // - ... // complete jxhr.complete( function (){ alert( " " ); });
  9. // , // jxhr- var jxhr = $.ajax({ url: "example.php" }) .success( function () { alert( "" ); }) .error( function () { alert( "" ); }) .complete( function () { alert( "" ); }); // - ... // complete jxhr.complete( function (){ alert( " " ); });


You can also create your own “pending objects” using jQuery.Deferred. For more information, see the documentation for Deferred objects .

jQuery.sub ()

jQuery now provides a new way, through which you can create and modify and clone jQuery - do everything using the full jQuery API. For example, you can use it to override your own jQuery methods, without actually affecting the methods that other users might work with, or even create encapsulated APIs for your plug-ins, which avoids name collisions.

For a visual demonstration, an example of creating a plugin encapsulating methods that do not conflict with any other plugin:

  1. ( function () {
  2. // Make a copy of jQuery using sub ()
  3. var plugin = jQuery.sub ();
  4. // Expand the capabilities of the resulting copy with new plugin methods
  5. plugin.fn.extend ({
  6. open: function () {
  7. return this .show ();
  8. },
  9. close: function () {
  10. return this .hide ();
  11. }
  12. });
  13. // Add our plugin to the original jQuery copy
  14. jQuery.fn.myplugin = function () {
  15. this .addClass ( "plugin" );
  16. // Make sure our plugin returns our "copied" version of jQuery
  17. return plugin ( this );
  18. };
  19. }) ();
  20. $ ( document ) .ready ( function () {
  21. // Call the plugin, the open method already exists
  22. $ ( '#main' ). myplugin (). open ();
  23. // Warning: the $ ("# main") call. Open () will not work, because the open () method does not exist!
  24. });
* This source code was highlighted with Source Code Highlighter .


More information about jQuery.sub () can also be found in the API documentation.

Productivity of adjacent elements iteration

Several frequently used methods were also improved in this release: .children (), .prev (), and .next (). The difference in processing speeds, which we can already observe, is quite significant (perhaps much faster, depending also on the browser).







Performance test or bare digits

Assembly system


Well, and, finally, were made about the internal jQuery build system. The team worked on standardizing the entire build process regarding the excellent NodeJS JavaScript environment. According to them, the team is especially pleased with the decrease in dependence on Java / Rhino systems, focusing on the environment of the future JavaScript (should we wait for server-side implementation of jQuery? - comment. Transl.).

At the same time, the transition from the Google Closure Compiler to UglifyJS was also completed . Changes were also noted for the better with respect to file size, and therefore the developers are even more satisfied with this transition.

Well, and, of course, the jQuery team continues to actively invite everyone to assist in the support of the jQuery core.

Write less, do more!

(updated)

Source: https://habr.com/ru/post/112912/


All Articles