Friday, January 15th, 2010

jQuery 1.4 is released

Category: JavaScript, jQuery, Library

<p>The incredibly popular jQuery library has released jQuery 1.4 on a new website that will celebrate 14 days of jQuery.

There are a lot of new features, and as usual performance gains are showcased.

  • Easy Setter Functions: For a while now, you’ve been able to pass a function into .attr() and the return value of that function is set into the appropriate attribute. This functionalilty has now been extended into all setter methods
  • Ajax: A lot of enhancements to the various remoting functions including support for native JSON parsing, etags, request context, and more
  • .css and .attr have been improved
  • Per property easing on effects
  • If you want to ensure that “this” inside a function will be permanently bound to a particular value, you can use jQuery.proxy to return a new function with that scope
  • New events: focusin and focusout

And Joe Walker will be really excited to see that dojo.create has made it in! :)

javascript
< view plain text >
  1. jQuery("<div />", {
  2.     id: "foo",
  3.     css: {
  4.         height: "50px",
  5.         width: "50px",
  6.         color: "blue",
  7.         backgroundColor: "#ccc"
  8.     },
  9.     click: function() {
  10.        $(this).css("backgroundColor", "red");
  11.     }
  12. }).appendTo("body");

Congrats to the jQuery team. I look forward to seeing posts over the next 2 weeks that go into more detail on the new coolness.

Related Content:

Posted by Dion Almaer at 12:13 am
23 Comments

+++--
3.6 rating from 117 votes

23 Comments »

Comments feed TrackBack URI

Woot! 3 x .html() speed! Rock on jQuery.

Comment by Skilldrick — January 15, 2010

The features are nice, but not liking the 70KB minified size.

Comment by jhiswin — January 15, 2010

I’ll be more annoyed if things start bugging on my website, but I’m planning ahead so I’m already annoyed by this:

Param serialization now happens in the PHP/Rails style by default. You can use jQuery.ajaxSettings.traditional = true; to use traditional parameter serialization.

Everyone who uses PHP and Rails should already know how to work around their quirky parameter naming issues. They shouldn’t need extra help, especially at the expense of everyone else.

How hard is this really:
{ 'param[]': val1, 'param[]': val2}

And given they’ll have to probably update anyway, to remove the workaround. Now everyone has to review their AJAX code before updating.

I know people will say the work around is simple and I don’t have to upgrade, I can use the 1.3 plugin, I can update the jQuery-1.4.min.js file, etc.

Yeah I can, but I’d rather I didn’t have to. Just so future Rails and PHP programmers can pretend that Rails and PHP have doesn’t have awkward parameter naming limitations.

Comment by Deadmeat — January 15, 2010

Addition to above, the new features look cool, and the performance improvements are impressive.

Comment by Deadmeat — January 15, 2010

@Deadmeat:

{ 'param[]': val1, 'param[]': val2}

Will just evaluate to

{'param[]': val2}

so that’s not an option.

Comment by Menno — January 15, 2010

Sorry I meant:
{'param[]': [val1, val2] }
Which from what I remember is what you need to do now. It’s what AJAXing a form used in a PHP page would do now for example.

Comment by Deadmeat — January 15, 2010

I’m also already using [] to pass arrays to PHP.

jQuery 1.4 can check if the parameter already has ‘[]‘. If so, it just does not have to emit them.

Comment by nhyone — January 15, 2010

Ah so it’s been made default only for future PHP and Rails websites. I haven’t tested this yet. I’ve just being going from the details in the linked article.

So basically older PHP and Rails websites will still work after the upgrade, and yet they would have still worked if it was the other way around too.

So jQuery has now inherited a limitation of PHP and Rails as the default. I could understand if there was any technical merit to doing it this way. But I guess it’s just because PHP and Rails are the environments of choice for jQuery developers.

Comment by Deadmeat — January 15, 2010

Awesome. I’m upgrading all my dev environments to 1.4 today

Comment by WillPeavy — January 15, 2010

Syntax example looks like Mootools

Comment by mmurph211 — January 15, 2010

>> And Joe Walker will be really excited to see that dojo.create has made it in! :)

Now jQuery needs dojo.declare().
:)

Comment by Les — January 15, 2010

Some very interesting changes. I in particularly like the improved setter methods, as well as the focusin/out events.

Comment by iliad — January 15, 2010

John gave a nice preview of jQuery 1.4 at Yahoo last month in the second half of this talk:

http://developer.yahoo.com/yui/theater/video.php?v=resig-testing

Comment by miraglia — January 15, 2010

@mmurph211: That was just the first thing I thought. And it does work great in MooTools.

Anyway, congrats for jQuery !

Comment by ArianStolwijk — January 15, 2010

@jhiswin:
use google load api to load jquery… and most users won’t even notice since it’ll go from their cache

Comment by DamirSecki — January 16, 2010

LMFAO! jQuery must like mustard, because the really love playing katch-up… Just in case anyone hasn’t been out of their jCave in quite a while, tons of the features in this 1.4 release are features that have been in Mootools/Prototype for YEARS…here are a few that really make me say “Holy guacamole Batman, you JUST figured this out?!?”

Passing Attributes to jQuery(…) – duh, duh, and one more thing, duh.

Binding Multiple Event Handlers – see above, and for chr*st sake people you should ALWAYS have been able to pass in multiple props/events/attrs etc via an object in these frameworks, if you couldn’t before they screwed the pooch. Period

Controlling a Function’s Context – uh, this actually came from Protoype JS, regardless of this “feature” being in 1.4, you should know that jQuery calls it “.proxy()” because it has always used the now native function context modifying method “.bind()” improperly to set event handlers – so in truth, this is not a feature, it is a work-around for not keeping up to date with javascript, tear ;(

Delay an Animation Queue – see Mootools 1.1, circa 2006

Check if an Element Has Something – gee, ya think?

Oh, but feel free to continue with the “OMG IE7 created tabbed browsing” party…

Comment by csuwldcat — January 16, 2010

To jQuery’s credit though, the different easing per property feature is really cool!

Comment by csuwldcat — January 16, 2010

@csuwldcat – See http://mootools.net/forge/p/fx_transmorph. You give MooTools fans a bad name with your constant, unprovoked ranting though…You should have a doctor take a look at that…

Comment by sixtyseconds — January 16, 2010

I’m a bit sad that .require did not make it and that .proxy has no currying, but in the end I’m really really having fun with the new functions :)

Comment by rosamez — January 16, 2010

@sixtyseconds – Yeah I saw transmorph in the forge, but still need to give props to jQuery because it was based off of their good idea.

Comment by csuwldcat — January 16, 2010

Very excited about jquery 1.4, especially the performance enhancements and per property easing.

Comment by Timmyw — January 20, 2010

Excellent thanks

Comment by Aphrodisiac — January 22, 2010

Why is this rag still posting puff pieces on this dubious script? It’s beyond laughable to talk about “improvements to attr”, speed (it’s always been a tortoise) and nonsense like:-

“f you want to ensure that “this” inside a function will be permanently bound to a particular value, you can use jQuery.proxy to return a new function with that scope”

Scope?! What does – this – have to do with scope? The “experts” can’t even speak the language, so they sure as hell can’t lead neophytes anywhere but off a cliff. ;) And how is another “hitch” function supposed to be a breakthrough feature? It’s basic bullshit. And you can bet they have introduced new and exciting memory leaks with that too. ;)

And how is it that these gushing pinheads can’t seem to find the only real browser scripting news that is out there right now? They know what it is, but theyduhwanna write about it. :( Hi Dion and Ben. You have _zero_ credibility as a news source. Zip.

Comment by DavidMark — January 22, 2010

Leave a comment

You must be logged in to post a comment.