jQuery 1.0.4

Posted on by

Another 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:


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

      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
    // 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)
      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
      // 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.

      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.

      if ( options.type == "POST" && options.data.length > 1024 )

    Example: Show a special message for requests submitted using an Ajax POST.

      if ( options.type == "POST" )

  • 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.

        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).

22 thoughts on “jQuery 1.0.4

  1. 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.

  2. Pingback: sorgalla.com - Updates

  3. 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.

  4. Pingback: jQuery: 1.0.4 is out. Time to upgrade!!! « Rip’s Domain

  5. Pingback: jQuery 1.0.4 | Scriptorama

  6. Pingback: BorkWeb » jQuery 1.0.4 Released

  7. 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"
      type: "POST",
      url: "/user/add/",
      data: params,
      processData: true
  8. Pingback: 15 Days Of jQuery : New Version of jQuery Released

  9. 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]

  10. @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 :-)

  11. jQuery.setAuto(…) is not present in this new version.
    interface/ifx.js needs it, do you have some suggest?

    Thanks :-)

  12. Pingback: jQuery mejora el Ajax con la 1.0.4 - aNieto2K

  13. Pingback: BlogsYa » jQuery mejora el Ajax con la 1.0.4

  14. 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…

  15. 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.

  16. Pingback: bassistance.de » jQuery related news: 1.0.4 release, people, tooltip

  17. Pingback: jQuery updates: 1.0.4, documentation, and people