diff options
author | Vladislav Zarakovsky <vlad.zar@gmail.com> | 2016-03-13 12:12:25 +0300 |
---|---|---|
committer | Vladislav Zarakovsky <vlad.zar@gmail.com> | 2016-03-13 12:12:25 +0300 |
commit | 42d8bc547ca5f6894fa6b96194ed7271a9256693 (patch) | |
tree | 5c0edb278eb73e736dfe96b9eaba3c33caed9eaf /awesomplete.js | |
parent | a8823bd996e7e2b713991a75b8fe267994b34981 (diff) | |
download | awesomplete-42d8bc547ca5f6894fa6b96194ed7271a9256693.zip awesomplete-42d8bc547ca5f6894fa6b96194ed7271a9256693.tar.gz awesomplete-42d8bc547ca5f6894fa6b96194ed7271a9256693.tar.bz2 |
Pass suggestion item to awesomplete-selectcomplete and awesomplete-highlight events
Diffstat (limited to 'awesomplete.js')
-rw-r--r-- | awesomplete.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/awesomplete.js b/awesomplete.js index 4666750..fe8e466 100644 --- a/awesomplete.js +++ b/awesomplete.js @@ -190,7 +190,9 @@ _.prototype = { this.status.textContent = lis[i].textContent; } - $.fire(this.input, "awesomplete-highlight"); + $.fire(this.input, "awesomplete-highlight", { + text: this.suggestions[this.index] + }); }, select: function (selected, origin) { @@ -201,15 +203,19 @@ _.prototype = { } if (selected) { + var suggestion = this.suggestions[this.index]; + var allowed = $.fire(this.input, "awesomplete-select", { - text: this.suggestions[this.index], + text: suggestion, origin: origin || selected }); if (allowed) { - this.replace(this.suggestions[this.index]); + this.replace(suggestion); this.close(); - $.fire(this.input, "awesomplete-selectcomplete"); + $.fire(this.input, "awesomplete-selectcomplete", { + text: suggestion + }); } } }, |