11 January 2009

jQuery Object Cache Update

After discussing with Andrew Luetgers some improvements that could be done to the Object Cache plugin, I updated the plugin to a new version.

The new improvement is that now you can store a selection automatically:

// Will store in cache $("#sidebarNav") with #sidebarNav key

This will let you avoid doing $("#menu").cache("menu"), which is a bit redundant. Now by doing $$("#menu") you will be able to store it in the cache and retrieve it automatically. There is also a reload option that you can pass to that call in order to, well, reload the the cached object with that selection:

// Will reload #sidebarNav with $("#sidebarNav")
$$("#sidebarNav", true);

You can grab the new version of the Object Cache plugin here.

20 November 2008

New jQuery plugin: Object Cache

Inspired by Benjamin Sterling's "Better jQuery Code" article I decided to develop a simple plugin to make his first point (Caching) easier... nothing fancy, just a few methods, but you will hopefully find it useful.

Its objective is to let you store a jQuery object with a simple key in a global cache, so that you can access the same object easily, without having to write the same selection, filtering or traversing code (i.e: $("#main < p") or $("#main").children(".selected").eq(0)).

Here is how it works:

// Store in cache - Returns current object

// Retrieve from cache - Returns cached object
$$("main_navigation"); // or jQueryCache("main_navigation");

// Remove from cache

// Clear Cache

// Load jQueryCache with noConflict to avoid overriding window.$$

There is a lot of room for improvement, which will be done depending on the feedback I get, so feel free to contact me with any ideas or corrections you might come up with.

You can get the Jquery Object Cache plugin here.

06 February 2008

jQuery UI 1.5a and jQuery Enchant 1.0a!

Finally we have alpha releases of jQuery UI 1.5 and jQuery Enchant 1.0 (which is the brand new effects library).

Of course it's far from being production ready, but it is a great preview of what the official releases will be. I can't wait to give jQuery Enchant a try!

22 November 2007

High-performance JavaScript: Why Everything You've Been Taught Is Wrong

That's the title of an interesting talk that was uploaded in Y! Video regarding javascript performance given by Plaxo's Chief Platform Architect, Joseph Smarr.

There are a few interesting ideas (most of them are not new, but it never hurts reminding them). As Joseph Smarr explains, when developing a new version of Plaxo, they found many performance issues that put in jeopardy the release of their new system.

It looks like at first they tried to develop their application without paying too much attention on browser's limitations, and without considering javascript's strengths and weaknesses (too much OOP boilerplate, as he says, like getters and setters and stuff…). However they were able to adopt new and better practices, that allowed them to ship Plaxo 3.0.

18 November 2007

New jQuery queueing plugin

I'm beginning this blog with a jquery plugin I had to develop a few weeks ago for a project I'm working on.

Even though jQuery is a great javascript library, its latest version brings a queue control, it doesn't work for different elements. That is, if you had something like

$("#myDiv").animate({fontSize: "30px"}).animate({marginLeft: "40px"})

it would queue the animations. But what if you wanted to be able to queue different elements (just like Scriptaculous allows)? Well, that's the reason why I developed the jQuery Fx Queues plugin. So go ahead and check it out, and feel free to send me your comments or any bugs you find.