diff options
author | Alex DiLiberto <alex@alexdiliberto.com> | 2015-02-25 20:04:01 -0500 |
---|---|---|
committer | Alex DiLiberto <alex@alexdiliberto.com> | 2015-02-25 20:04:01 -0500 |
commit | db991e1817f90d7bd5cf2ca1b25d4f4229335bd0 (patch) | |
tree | b1262e7192731d707cac0b60c31679971d2bc3db /awesomplete.js | |
parent | ce9aad862dd2f199160411a428632bc980b73632 (diff) | |
download | awesomplete-db991e1817f90d7bd5cf2ca1b25d4f4229335bd0.zip awesomplete-db991e1817f90d7bd5cf2ca1b25d4f4229335bd0.tar.gz awesomplete-db991e1817f90d7bd5cf2ca1b25d4f4229335bd0.tar.bz2 |
Updated to user prototype getter `opened` for keydown handling
Diffstat (limited to 'awesomplete.js')
-rw-r--r-- | awesomplete.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/awesomplete.js b/awesomplete.js index 653b524..43de0f9 100644 --- a/awesomplete.js +++ b/awesomplete.js @@ -58,7 +58,7 @@ var _ = self.Awesomplete = function (input, o) { // If the dropdown `ul` is in view, then act on keydown for the following keys: // Enter / Esc / Up / Down - if(me.ul && me.ul.getAttribute("hidden") == null) { + if(me.opened) { if (c === 13 && me.selected) { // Enter evt.preventDefault(); me.select(); @@ -129,6 +129,10 @@ _.prototype = { return this.index > -1; }, + get opened() { + return this.ul && this.ul.getAttribute("hidden") == null; + }, + close: function () { this.ul.setAttribute("hidden", ""); this.index = -1; |