2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-22 04:45:12 +00:00

Rev for 1.2.25 release

This commit is contained in:
Tomas Kirda 2016-06-14 16:17:00 -05:00
parent 3f53453499
commit 95a329d80d
5 changed files with 18 additions and 10 deletions

View File

@ -1,6 +1,6 @@
{
"name": "devbridge-autocomplete",
"version": "1.2.24",
"version": "1.2.25",
"homepage": "https://github.com/devbridge/jQuery-Autocomplete",
"authors": [
"Tomas Kirda"

View File

@ -6,7 +6,7 @@
"ajax",
"autocomplete"
],
"version": "1.2.24",
"version": "1.2.25",
"author": {
"name": "Tomas Kirda",
"url": "https://github.com/tkirda"

View File

@ -1,5 +1,5 @@
/**
* Ajax Autocomplete for jQuery, version 1.2.24
* Ajax Autocomplete for jQuery, version 1.2.25
* (c) 2015 Tomas Kirda
*
* Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
@ -127,8 +127,13 @@
$.Autocomplete = Autocomplete;
Autocomplete.formatResult = function (suggestion, currentValue) {
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
// Do not replace anything if there current value is empty
if (!currentValue) {
return suggestion.value;
}
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
return suggestion.value
.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>')
.replace(/&/g, '&amp;')
@ -188,6 +193,7 @@
// Listen for click event on suggestions list:
container.on('click.autocomplete', suggestionSelector, function () {
that.select($(this).data('index'));
return false;
});
that.fixPositionCapture = function () {
@ -208,8 +214,10 @@
onFocus: function () {
var that = this;
that.fixPosition();
if (that.options.minChars === 0 && that.el.val().length === 0) {
if (that.el.val().length >= that.options.minChars) {
that.onValueChange();
}
},
@ -672,7 +680,7 @@
html += formatGroup(suggestion, value, i);
}
html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value) + '</div>';
html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value, i) + '</div>';
});
this.adjustContainerWidth();
@ -681,7 +689,7 @@
container.html(html);
if ($.isFunction(beforeRender)) {
beforeRender.call(that.element, container, that.sugestions);
beforeRender.call(that.element, container, that.suggestions);
}
that.fixPosition();

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "devbridge-autocomplete",
"version": "1.2.24",
"version": "1.2.25",
"description": "Autocomplete provides suggestions while you type into the text field.",
"homepage": "https://github.com/devbridge/jQuery-Autocomplete",
"author": "Tomas Kirda (https://twitter.com/tkirda)",