From 5bd229febe7956ee9fd49644999198cbce99dbe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=20=EC=9E=AC=EC=84=9D?= Date: Fri, 27 May 2016 14:20:32 +0900 Subject: [PATCH] place event listeners in options parameter. --- src/jquery.autocomplete.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/jquery.autocomplete.js b/src/jquery.autocomplete.js index bd933ce..98390df 100644 --- a/src/jquery.autocomplete.js +++ b/src/jquery.autocomplete.js @@ -204,11 +204,29 @@ $(window).on('resize.autocomplete', that.fixPositionCapture); + if ($.isFunction(that.options.onKeyPress)) { + that.el.on('keydown.autocomplete', function (e) { that.options.onKeyPress.call(that, e); }); + } that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); }); + if ($.isFunction(that.options.onKeyUp)) { + that.el.on('keyup.autocomplete', function (e) { that.options.onKeyUp.call(that, e); }); + } that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); }); + if ($.isFunction(that.options.onBlur)) { + that.el.on('blur.autocomplete', function (e) { that.options.onBlur.call(that, e); }); + } that.el.on('blur.autocomplete', function () { that.onBlur(); }); + if ($.isFunction(that.options.onFocus)) { + that.el.on('focus.autocomplete', function (e) { that.options.onFocus.call(that, e); }); + } that.el.on('focus.autocomplete', function () { that.onFocus(); }); + if ($.isFunction(that.options.onKeyUp)) { + that.el.on('change.autocomplete', function (e) { that.options.onKeyUp.call(that, e); }); + } that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); }); + if ($.isFunction(that.options.onKeyUp)) { + that.el.on('input.autocomplete', function (e) { that.options.onKeyUp.call(that, e); }); + } that.el.on('input.autocomplete', function (e) { that.onKeyUp(e); }); },