default array matching behaviour of autocomplete can lead to unexpected results

default array matching behaviour of autocomplete can lead to unexpected results

When providing an array to the autocomplete control the default
matcher tries to match on the item's value before trying the item's
label.  This can lead to unexpected behaviour when the value and label
have little in common.

For example:

$('#some-control').autocomplete({source:[{value:1, label:"one"}, {value:2, label:"two"}]});

The user will try to get to "one" by typing "o...n..." but will never
get there as the widget is testing against [1, 2] not ["one", "two"].

Line 155 in in trunk (SVN-3841) is:

  return matcher.test( value.value || value.label || value );

I think changing this to;

  return matcher.test( value.label || value.value || value );

would lead to more consistent behaviour.  The developer still needs to
override select and focus in order to correctly update the contents of
the widget with the label instead of the value but this is the common
case when providing a value and label anyway (as once the user makes a
selection the developer needs to stash the item's value away in a
hidden field somewhere).

This change means you don't also have to override source for the
common case.

regards, Simon Cusack.