jQuery Roundup

19 Oct 2010 | By Alex Young | Tags jquery plugins voip

Welcome to the jQuery Roundup 28. You can send your plugins and articles in for review through our contact form or @dailyjs.

jQuery 1.4.3 Released

jQuery 1.4.3 is out and it now passes Crockford’s JSLint, which means Crockfordites can finally put down their pitchforks. Something else interesting I noticed (given how I harp on about this in the Let’s Make a Framework posts) was that the internal modules are less dependent on each other, which means chunks of the framework can be used in isolation.

There are a lot of other changes too, especially in the CSS module. I like the fact jQuery.fx.interval can be used to control animation smoothness, at the expense of CPU cycles.

All this from a so-called minor release!

jQuery 1.4.3 is passing 3621 tests on all supported browsers. We’re 100% passing on Firefox 4 and nearly passing in IE 9 (we discovered two bugs, filed them, and one of them has already been fixed).

The blog post has full details, with benchmarks and graphs. And if you really like reading about jQuery changes, it’s worth following on GitHub/jquery.

Phono

Phono is a jQuery plugin and SDK for working with phones and IM. The server-side components are Voxeo Cloud and Tropo, but the authors want to release a gateway to allow SIP VoIP communication without Voxeo. The plugin is made by Voxeo, and is released under the Apache2 license.

Events for ringing, answering, and hanging up are passed in using a simple object:

$("#call").click(function() {
  $("#call").attr("disabled", true).val("Busy");
  phono.phone.dial("985-655-2500", {
    onRing: function() {
      $("#status").html("Ringing");
    },
    onAnswer: function() {
      $("#status").html("Answered");
    },
    onHangup: function() {
      $("#call").attr("disabled", false).val("Call");
      $("#status").html("Hangup");
    }
  });
});

I think this is an interesting project with a friendly API for us JavaScript developers. I’ve always wanted to make something with Tropo but I haven’t thought up a suitable project yet.

Sean Koole’s jQuery Posts

Sean Koole sent me a link to his blog, where he writes about JavaScript and jQuery. In On jQuery and Caching he writes about how to reduce the amount of jQuery objects that get created when instantiating elements. He describes several solutions, like chaining calls or assigning $(this) to a variable.

Koole discusses the differences between $.fn.each and $.fn.map in Fine dining, jQuery’s map and each… He also covers $.fn.clone in What you should know about cloning form values, which is useful reading if you haven’t yet had to deal with the weird world of IE and cloning elements.

Digging into jQuery 1.4.3’s data method is a lengthier article all about the changes to the data method. He actually explains the internal changes and how they relate to native JavaScript behaviour.

Closure

The jQuery Closure plugin by Paul Hinds (MIT and GPL) provides this:

jQuery.callback = function(object, method) {
    return function() {
       return method.apply(object, arguments);
    };
};

So callbacks can be written using $.callback():

$('selector').click($.callback(this, this.eventHandler));

This makes it a little bit easier to follow closure capturing. Arguments can also be captured with $.closeArgs():

var i = 0;
for(; i < 5; i++) {
	  jQuery('#id' + i).click($.closeArgs(this, this.myEventHandler, i));
}

In combination these methods are similar to Prototype’s bind.


blog comments powered by Disqus