The big five-oh, Auto Complete 5.0

November 22, 2009

It's taken awhile, but another large update to the autoComplete plugin is finally here. Major improvements have been made across the board on this update, including multiple methods and callbacks added to allow developers to take more control of each instance. Here's a short-list of changes/features:

jQuery.autoComplete

An autoComplete object has been added to the base jQuery object. The object contains a number of methods outlined in the docs, but most importantly, a global object of autoComplete settings have been attached under jQuery.autoComplete.defaults.

Paging and Scrolling

The plugin now takes advantage of the page up/down keys, moving the active element across a full page view of list items. It also scrolls the drop list automatically, mimicking browser select drop downs as close as possible.

Auto Fill

Completion of the input with the element in focus has been implemented. The rest of the input is selected for easy deletion with the backspace if needed.

Event Delegation

The drop down list uses event delegation with it's mouse effects, only caching elements as the mouse moves over an element, and operating on that element when clicking/mouseout.

Speed Improvements

After a refactoring of how the list is loaded, 5.0 boasts a 10x speed improvement over 4.1. On top of that, autoComplete is now timer independent, so lists can be loaded instantaneously if needed.

Callbacks

A fundamental change to the way callbacks are run has been implemented as well. I know that this may break a few code bases, so a backwardsCompatible option has been added for those instances. Set this flag to true for callbacks to pass the same parameters they used to pass.

While I understand instant change of code bases is impossible, I encourage everyone to start updating their code. Remember, with the metadata plugin, you can update your code instance by instance, slowly upgrading to the new style so you can harness the ease of event - ui parameters. Also makes upgrading in the future seamless, as new parameters can just be attached to the ui object, instead of adding to the end of a long list of parameters.

Flaw in 4.1

Another change that was made, that will only affect a few scripts that manually trigger methods outside of the autoComplete plugin, is the removal of deep namespacing of methods. jQuery doesn't support deep namespacing, a flaw in logic of the 4.1 version. A check has been added to the base autoComplete function, that changes all '.' to '-' of method names.

Documentation and Download

Auto Complete documentation has a thorough list of options to choose from. To download, go the the project home page.

Have a question or comment? ask@codenothing.com.