Blog » jQuery 1.0.4
Posted December 12th, 2006 by John ResigAnother fantastic release of jQuery is ready for your consumption. This release includes a number of bug fixes (as usual) along with some much-needed improvements to jQuery’s Ajax functionality.
As always, if you have any questions or concerns with new release, please feel free to discuss it on the jQuery Mailing List. If you think you’ve spotted a bug, please add it to the bug tracker.
So, without further ado, here’s jQuery 1.0.4:
Download
- Compressed JavaScript (Recommended Download!)
- Uncompressed JavaScript
- 1.0.4 Documentation
- 1.0.4 Test Suite
- Full Release (jQuery, Test Suite, Documentation)
- Build Files (Compile your own version of jQuery 1.0.4)
Changes and Features
- Tons of bug fixes (Full List)
- Extensions to $.ajax(): $.ajax accepts additional options: beforeSend, async and processData; returns XMLHttpRequest to allow manual aborting of requests, see docs for details.
Example: Add extra headers to an Ajax request using beforeSend
$.ajax({ type: "POST", url: "/files/add/", beforeSend: function(xhr) { xhr.setRequestHeader( "Content-type", "text/plain" ); }, data: "This is the contents of my text file." });Example: Perform a synchronous Ajax request.
// Get the HTML of a web page and save it // to a variable (the browser will freeze until the // entire request is completed). var html = $.ajax({ type: "GET", url: "test.html", async: false }).responseText; // Add the HTML into the page $("#list").html( html );Example: Sending a JavaScript object using processData.
// The data to send to the server var params = { name: "John", city: "Boston" }; // Send the data, but have it be converted into // a format the server can understand (w/ processData) $.ajax({ type: "POST", url: "/user/add/", data: params, processData: true });Example: Aborting an Ajax request after a specific delay in time.
// Perform a simple Ajax request var req = $.ajax({ type: "GET", url: "/user/list/", success: function(data) { // Do something with the data... // Then remove the request. req = null; } }); // Wait for 5 seconds setTimeout(function(){ // If the request is still running, abort it. if ( req ) req.abort(); }, 5000); - AJAX module: The public $.ajax API is now used internally (for $.get/$.post etc.); loading scripts works now much more reliably in all browsers (with the exception of Safari, which is a work in progress).
- New global Ajax handler: ajaxSend - called before an Ajax request is sent.
Example: Add extra headers to all Ajax requests using the ajaxSend event.
$(document).ajaxSend(function(xhr){ xhr.setRequestHeader("X-Web-Request", "MySite.com"); }); - Extensions to global Ajax handlers: ajaxSend, ajaxSuccess, ajaxError and ajaxComplete get XMLHttpRequest and settings passed as arguments.
Example: Prevent any POST requests that are sending too much data.
$(document).ajaxSend(function(xhr,options){ if ( options.type == "POST" && options.data.length > 1024 ) xhr.abort(); });Example: Show a special message for requests submitted using an Ajax POST.
$("#dataSent").ajaxSend(function(xhr,options){ if ( options.type == "POST" ) $(this).show(); }); - Extensions to event handling: pageX and pageY are available in all browsers now. (IE does not provide native pageX/Y).
Example: Have a tooltip follow a user’s mouse around the page.
$(document).mousemove(function(e){ $("#mousetip").css({ top: e.pageY + "px", left: e.pageX + "px" }); }); - Improved docs: $(String) method has now two separate descriptions, one for selecting elements, one for creating html on-the-fly.
- FX module: Most inline styles added by animations are now removed when the animation is complete, eg. height style when animating height (exception: display styles).
December 12th, 2006 at 9:02 pm
You rock John (and jQuery team
)
December 12th, 2006 at 9:13 pm
I forgot to mention: As with most of the 1.0.x releases, much of this release was due to the hard work of Jörn Zaefferer.
I plan on doing a post, soon, doing a who’s who of jQuery. There’s many people who help out right now, in many ways (coding, testing, documentation, plugins, design, web site, marketing) and they all need to be thanked.
December 13th, 2006 at 2:30 am
Many thanks, I like the pageX, pageY example the most!
December 13th, 2006 at 3:14 am
[…] Bonne nouvelle, la version 1.04 de la librarie vient de sortir avec un tonne de bugs corrigés et quelques nouvelles fonctionnalités. Consultez l’annonce pour plus détails directement sur le blog de jQuery. […]
December 13th, 2006 at 4:50 am
[…] Additionally, jCarousel is delivered with the brand new jQuery 1.0.4. […]
December 13th, 2006 at 5:32 am
Problem with IE and the test suite:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Avant Browser; Avant Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
core module: not(String) (1, 1, 2)
- not(’selector’)
- not(’selector, selector’) expected: [object],[object],[object],[object], result: [object],[object],[object],[object],[object]
ajax module: $.ajax - beforeSend (1, 0, 1)
- check return value, should be the custom header sent
Tests completed in 12703 milliseconds.
2 tests of 288 failed.
December 13th, 2006 at 7:19 am
Great job.
Thanks for all team.
December 13th, 2006 at 8:55 am
[…] Yesterday saw another fantastic release of jQuery to 1.0.4. The are numerous bug fixes in this release, too many to go over. […]
December 13th, 2006 at 9:31 am
[…] John Resig en de rest van ‘t jQuery-team hebben een verse release voor ons JavaScript-gemak: jQuery 1.0.4. De nadruk ligt vooral op Ajax-functionaliteit. De nieuwe $.ajax()-uitbreidingen geven je o.a. rechtstreeks toegang tot ‘t gebruikte XMLHttpRequest object. Hierdoor kun je bijvoorbeeld headers inpluggen of requests afbreken. Daarnaast zijn event.pageX en event.pageY nu in alle browsers beschikbaar, ook in Internet Explorer. Nog niet bekend met jQuery? Eerder gaven we een korte inleiding. Voor prima voorbeelden kun je terecht op learningjquery.com. […]
December 13th, 2006 at 10:56 am
[…] John Resig over at jQuery has announced the release of jQuery 1.0.4 to the public! As usual, there are bug fixes…plus a bit more. His focus for this patch was adding improvements to jQuery’s Ajax functionality. Below is a list of all the updates: […]
December 13th, 2006 at 11:00 am
Please note that the processData example above is not correct. It should be:
// The data to send to the server var params = { name: "John", city: "Boston" }; $.ajax({ type: "POST", url: "/user/add/", data: params, processData: true });December 13th, 2006 at 11:06 am
Good catch, Mike! I fixed the example to be correct.
December 13th, 2006 at 3:24 pm
[…] Just announced today, version 1.0.4 of jQuery was released. […]
December 13th, 2006 at 11:13 pm
jQuery 1.0.4.
Poprawki, bugfiksy, Ajax. Czyli nowa wersja mojej ukochanej biblioteki JavaScript. Mappet już na niej śmiga (może zacznie działać na Safari?).
December 14th, 2006 at 7:35 am
Problem with FF2.0 and the test suite:
# core module: not(String) (1, 1, 2)
1. not(’selector’)
2. not(’selector, selector’) expected: [object HTMLParagraphElement],[object HTMLParagraphElement],[object HTMLParagraphElement],[object HTMLParagraphElement], result: [object HTMLParagraphElement],[object HTMLParagraphElement],[object HTMLParagraphElement],[object HTMLParagraphElement],[object HTMLParagraphElement]
December 14th, 2006 at 11:27 am
@Giel: That error is expected. That’s a feature that we’re working to implement in jQuery (but isn’t in yet). So we built the test case before, so that we have something to work towards
December 18th, 2006 at 11:07 am
John and the team. You’re really really great. jQuery genius!!!
:)
December 18th, 2006 at 11:44 am
jQuery.setAuto(…) is not present in this new version.
interface/ifx.js needs it, do you have some suggest?
Thanks
December 18th, 2006 at 6:36 pm
[…] En la lucha de los frameworks de Javascript, jQuery ha dado hoy un paso importante con una nueva versión y las modificaciones añadidas al objeto Ajax. […]
December 18th, 2006 at 7:01 pm
[…] El módulo Ajax, pasa a ser $.ajax() en lugar de $.get()/$.post(), que los usará internamente dependiendo del parametro type que definamos.Además han añadido un handler nuevo destinado a controlar los eventos Ajax, de esta forma dispondremos de métodos ajaxSend, ajaxSuccess, ajaxError y ajaxComplete para trabajar con él. Y muchas más… […]
December 18th, 2006 at 7:11 pm
[…] En la lucha de los frameworks de Javascript, jQuery ha dado hoy un paso importante con una nueva versión y las modificaciones añadidas al objeto Ajax. […]
December 20th, 2006 at 3:45 am
jQuery.setAuto(…) is not present in this new version.
interface/ifx.js requires it and it worries me as well.
I manually moved some piece of code from 1.0.3, but…
December 20th, 2006 at 4:21 am
[…] Ето тук може да видите повече за промените в новата версия. […]
December 20th, 2006 at 5:09 am
var options = { ‘dataType’ : ‘json’ } or var options = { ‘dataType’ : ‘html’ }
$.ajax( options );
Not works, it sends me XML data back
Whatever - Thank You! jQuery is wonderful, and it’s better and better each day.
December 22nd, 2006 at 5:27 am
[…] jQuery 1.0.4 was released on 12th Dezember, featuring tons of bug fixes and several improvements to API documentation in general and with focus on the AJAX module. Details can be found in John’s release entry. […]
January 8th, 2007 at 11:44 pm
[…] A new 1.0.4 release focused on updates to the Ajax functionality: […]