src/aria/widgets/controllers/AutoCompleteController.js
function (suggestions, textEntry) {
                var matchValueIndex = -1, suggestion;
                for (var index = 0, len = suggestions.length, label, ariaLabel; index < len; index += 1) {
                    suggestion = suggestions[index];
                    // if it's the first exact match, store it
                    if (matchValueIndex == -1) {
                        if (suggestion.exactMatch) {
                            matchValueIndex = index;
                        }
                    }
                    label = this._getLabelFromSuggestion(suggestion);
                    ariaLabel = this.waiSuggestionAriaLabelGetter ? this.waiSuggestionAriaLabelGetter({
                        value: suggestion,
                        index: index,
                        total: len
                    }) : null;
                    var tmp = {
                        entry : textEntry,
                        label : label,
                        ariaLabel : ariaLabel,
                        value : suggestion
                    };
                    suggestions[index] = tmp;
                }
                return this.preselect === "none" ? -1 : matchValueIndex;
            }
function (suggestions, textEntry) {
                var matchValueIndex = -1, suggestion;
                for (var index = 0, len = suggestions.length, label, ariaLabel; index < len; index += 1) {
                    suggestion = suggestions[index];
                    // if it's the first exact match, store it
                    if (matchValueIndex == -1) {
                        if (suggestion.exactMatch) {
                            matchValueIndex = index;
                        }
                    }
                    label = this._getLabelFromSuggestion(suggestion);
                    ariaLabel = this.waiSuggestionAriaLabelGetter ? this.waiSuggestionAriaLabelGetter({
                        value: suggestion,
                        index: index,
                        total: len
                    }) : null;
                    var tmp = {
                        entry : textEntry,
                        label : label,
                        ariaLabel : ariaLabel,
                        value : suggestion
                    };
                    suggestions[index] = tmp;
                }
                return this.preselect === "none" ? -1 : matchValueIndex;
            }
function ( suggestions , textEntry ) { var matchValueIndex = - 1 , suggestion ; for ( var index = 0 , len = suggestions . length , label , ariaLabel ; index < len ; index += 1 ) { suggestion = suggestions [ index ] ; // if it's the first exact match, store it if ( matchValueIndex == - 1 ) { if ( suggestion . exactMatch ) { matchValueIndex = index ; } } label = this . _getLabelFromSuggestion ( suggestion ) ; ariaLabel = this . waiSuggestionAriaLabelGetter ? this . waiSuggestionAriaLabelGetter ( { value : suggestion , index : index , total : len } ) : null ; var tmp = { entry : textEntry , label : label , ariaLabel : ariaLabel , value : suggestion } ; suggestions [ index ] = tmp ; } return this . preselect === "none" ? - 1 : matchValueIndex ; }
reformat the suggestions to be compatible with the list widget and search for perfect match
@protected
@param {Array} suggestions
@param {String} textEntry
@return {Number} index of the first exact match, or -1
reformat the suggestions to be compatible with the list widget and search for perfect match