jQuery 1.2! Woo!

Tom's picture
Tags: 

I'm kind of a jQuery fanboy. Nontechnical friends following my Twitter feed are sick of hearing about it; my colleagues at EchoDitto have learned to avoid mentioning competing JS libraries around me, lest they be subjected to a long and increasingly enthusiastic speech about why they should be using jQuery instead. It's a bit embarrassing. I've used script.aculo.us, moo.fx, and read enough of the Dojo docs to become deeply confused. But jQuery's the one for me.

And, excitingly, a new version was released on Monday. Let's have a look at the biggest changes, shall we (or at least the ones that seem most immediately relevant to me)?

  • No more XPath. I like XPath. I used it in a bunch of GreaseMonkey scripts, and it seemed like an intuitive and efficient way to access the DOM. But I never found myself using it in jQuery. I'm not sure why — like everything else associated with CSS, the CSS2/3 selectors that jQuery dutifully supports seem byzantine, and etymologically unmoored. Continuing the adherence to CSS tradition, you can accomplish what you need to do, but only in the least intuitive way possible.

    But I still found myself using CSS in $() — it just seemed to be jQuery's first language — and even I can admit that supporting a CSS/XPath mishmash in the $() selector was a messy idea. XPath support is now available as a plugin, should you find yourself wanting it.
  • A more valiant .val(). Man, could I ever have used this last week: $().val() now supports checkboxes, radio buttons and select lists in a more robust manner. This is much-needed — there have been form field plugins available for a while, but in my experience they don't play nicely with Drupal's []-laden form field names. I haven't tested out the new functionality with Drupal, but if it works as advertised I'll be a happy camper.
  • Built-in functionality from the Dimensions plugin. I've been using the aforementioned plugin recently and finding myself extremely pleased with it. It'll be great to have $().height(), $().width() and $().offset() methods properly available in jQuery core.
  • New animation goodies. Color animation, support for percentages and relative positioning, and an animation-queueing system.
  • AJAX Changes. JSONP is now supported; a bunch of AJAX convenience methods no longer are. It's nothing too earth-shattering, but I suspect this is the change from 1.1 that's likely to break the most code (albeit never in a very serious way).

But never fear — this doesn't appear to be a bugfix-focused release; nobody's making you upgrade. And in addition to the XPath plugin, there's a 1.1 compatibility plugin.

Overall, it looks like a lot of useful changes — although that just makes the fact that the release comes days after my last jQuery binge sting all the more.

If you've used the Interface

If you've used the Interface plugin for jQuery, and are excited about the new jQuery 1.2, as I am, you should also check out jQuery UI. This was released on Sunday, less than a week after 1.2 was released. Check it out at http://ui.jquery.com/.

Thanks for the tip, Joshua.

Thanks for the tip, Joshua. I have to confess that I haven't had a need for fancy UI effects since my jQuery conversion. But the UI plugin certainly looks impressive -- it's nice to know I won't have to go crawling back to scriptaculous if a client insists on drag-n-drop.

FDSAGSDF DFHSGF DFHGFH

FDSAGSDF DFHSGF DFHGFH RTSHDDT RSTHRSHR RSTHRS SRTH

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockcode>
  • Lines and paragraphs break automatically.
  • You may post block code using <blockcode [type="language"]>...</blockcode> tags. You may also post inline code using <code [type="language"]>...</code> tags.

More information about formatting options

Captcha
Are you a robot? We usually like robots, but not in our comments.