Plugins

The plugins site is currently in development.

We've been looking to provide a higher-quality, spam-free experience at the plugins site for some time, and a major error on our part forced us to shut down the current site before we could put the new one in place. We are developing a new site, and you can follow along with its development on GitHub. For more information about this transition, including steps you can take as a plugin author to prepare, please read our post about what's going on.

Object Cache


jQuery Selection Cache is a simple plugin inspired by Benjamin Sterling's "Better jQuery Code" article, by Luciano Germán Panaro.

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)).

There is a lot of room for improvement, which will be done depending on the feedback I get, so feel free to contact me through my website.

---------------

Here is how it works:

    // Store in cache - Returns current object
    $("#mainNav").cache("main_navigation");

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

    // Remove from cache
    $$.remove("main_navigation");

    // Clear Cache
    $$.clear();

    // Load jQueryCache with noConflict to avoid overriding window.$$
    $$.noConflict();

Downloads



5
Your rating: None Average: 5 (1 vote)