Skip to content
Snippets Groups Projects
Commit d8314c7d authored by Chris Hallberg's avatar Chris Hallberg
Browse files

autocomplete.js no-shadow changes. Removes global input due to passing.

parent 4f5b4f74
No related merge requests found
/*global jQuery, window, document, console, setTimeout, clearTimeout */ /* global jQuery, window, document, console, setTimeout, clearTimeout */
/** /**
* crhallberg/autocomplete.js 0.15 * crhallberg/autocomplete.js 0.15.1
* ~ @crhallberg * ~ @crhallberg
*/ */
(function autocomplete( $ ) { (function autocomplete( $ ) {
var cache = {}, var cache = {},
element = false, element = false,
input = false,
options = { options = {
ajaxDelay: 200, ajaxDelay: 200,
cache: true, cache: true,
...@@ -119,8 +118,8 @@ ...@@ -119,8 +118,8 @@
} }
} }
function setup(input, element) { function setup(input) {
if (typeof element === 'undefined') { if ($('.autocomplete-results').length == 0) {
element = $('<div/>') element = $('<div/>')
.addClass('autocomplete-results hidden') .addClass('autocomplete-results hidden')
.html('<i class="item loading">' + options.loadingString + '</i>'); .html('<i class="item loading">' + options.loadingString + '</i>');
...@@ -260,12 +259,7 @@ ...@@ -260,12 +259,7 @@
return this; return this;
} else { } else {
options = $.extend( {}, options, settings ); options = $.extend( {}, options, settings );
element = $('.autocomplete-results'); setup(input);
if (element.length == 0) {
element = setup(input);
} else {
setup(input, element);
}
} }
return input; return input;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment