jQuery 1.4 has landed!

I’ve been using jQuery for most of a year now, having been a YUI man for years. I absolutely love it.

I have had a few gripes about jQuery, however, but I’m pleased to say that as of yesterday, many of them were addressed.

One of the gripes I’ve had with jQuery is the messiness of building an element string:

jQuery('a href="' + url + '" class="' + classes.join(" ") + '">' +
  '' + linkText + '');

This can get quite big in some cases, spanning multiple lines.

jQuery 1.4 lets you create elements with a second “attributes” argument:

jQuery('', {
    href: url,
    className: classes.join(" "),
    html: '' + linkText + ''
});

Note the “html” attribute. That’s the same as writing:

jQuery('')
  .html('' + linkText + '');

Obviously, there are times when you’ll want to use one or the other… but for many situations, this will fit very well into jQuery’s “configuration-based” theory of expressive programming.

Here’s a rundown on 15 new features.