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

Make jshint happy.

This commit is contained in:
Tomas Kirda 2014-10-11 12:05:08 -05:00
parent 587414b143
commit 05a337cba9

View File

@ -6,8 +6,8 @@
* For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete * For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
*/ */
/*jslint browser: true, white: true, plusplus: true */ /*jslint browser: true, white: true, plusplus: true, vars: true */
/*global define, window, document, jQuery, exports */ /*global define, window, document, jQuery, exports, require */
// Expose plugin as an AMD module if AMD loader is present: // Expose plugin as an AMD module if AMD loader is present:
(function (factory) { (function (factory) {
@ -265,8 +265,9 @@
containerParent = $container.parent().get(0); containerParent = $container.parent().get(0);
// Fix position automatically when appended to body. // Fix position automatically when appended to body.
// In other cases force parameter must be given. // In other cases force parameter must be given.
if (containerParent !== document.body && !that.options.forceFixPosition) if (containerParent !== document.body && !that.options.forceFixPosition) {
return; return;
}
// Choose orientation // Choose orientation
var orientation = that.options.orientation, var orientation = that.options.orientation,
@ -275,7 +276,7 @@
offset = that.el.offset(), offset = that.el.offset(),
styles = { 'top': offset.top, 'left': offset.left }; styles = { 'top': offset.top, 'left': offset.left };
if (orientation == 'auto') { if (orientation === 'auto') {
var viewPortHeight = $(window).height(), var viewPortHeight = $(window).height(),
scrollTop = $(window).scrollTop(), scrollTop = $(window).scrollTop(),
topOverflow = -scrollTop + offset.top - containerHeight, topOverflow = -scrollTop + offset.top - containerHeight,
@ -386,16 +387,21 @@
that.selectHint(); that.selectHint();
return; return;
} }
/* falls through */ if (that.selectedIndex === -1) {
that.hide();
return;
}
that.select(that.selectedIndex);
if (that.options.tabDisabled === false) {
return;
}
break;
case keys.RETURN: case keys.RETURN:
if (that.selectedIndex === -1) { if (that.selectedIndex === -1) {
that.hide(); that.hide();
return; return;
} }
that.select(that.selectedIndex); that.select(that.selectedIndex);
if (e.which === keys.TAB && that.options.tabDisabled === false) {
return;
}
break; break;
case keys.UP: case keys.UP:
that.moveUp(); that.moveUp();