|
160 | 160 | container.width(options.width); |
161 | 161 | } |
162 | 162 |
|
163 | | - // Listen for mouse over event on suggestions list: |
164 | | - container.on('mouseover.autocomplete', suggestionSelector, function () { |
165 | | - that.activate($(this).data('index')); |
166 | | - }); |
167 | | - |
168 | | - // Deselect active element when mouse leaves suggestions container: |
169 | | - container.on('mouseout.autocomplete', function () { |
170 | | - that.selectedIndex = -1; |
171 | | - container.children('.' + selected).removeClass(selected); |
172 | | - }); |
173 | | - |
174 | | - // Listen for click event on suggestions list: |
175 | | - container.on('click.autocomplete', suggestionSelector, function () { |
176 | | - that.select($(this).data('index')); |
177 | | - }); |
| 163 | + // Add listeners to suggestion list |
| 164 | + container |
| 165 | + // Listen for mouse over event on suggestions list: |
| 166 | + .on('mouseover.autocomplete', suggestionSelector, function () { |
| 167 | + that.activate($(this).data('index')); |
| 168 | + }) |
| 169 | + // Deselect active element when mouse leaves suggestions container: |
| 170 | + .on('mouseout.autocomplete', function () { |
| 171 | + that.selectedIndex = -1; |
| 172 | + container.children('.' + selected).removeClass(selected); |
| 173 | + }) |
| 174 | + // Listen for click event on suggestions list: |
| 175 | + .on('click.autocomplete', suggestionSelector, function () { |
| 176 | + that.select($(this).data('index')); |
| 177 | + }); |
178 | 178 |
|
179 | 179 | that.fixPositionCapture = function () { |
180 | 180 | if (that.visible) { |
|
184 | 184 |
|
185 | 185 | $(window).on('resize.autocomplete', that.fixPositionCapture); |
186 | 186 |
|
187 | | - that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); }); |
188 | | - that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); }); |
189 | | - that.el.on('blur.autocomplete', function () { that.onBlur(); }); |
190 | | - that.el.on('focus.autocomplete', function () { that.onFocus(); }); |
191 | | - that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); }); |
192 | | - that.el.on('input.autocomplete', function (e) { that.onKeyUp(e); }); |
| 187 | + // Add listeners to input field |
| 188 | + that.el |
| 189 | + .on('keydown.autocomplete', function (e) { that.onKeyPress(e); }) |
| 190 | + .on('keyup.autocomplete', function (e) { that.onKeyUp(e); }) |
| 191 | + .on('blur.autocomplete', function () { that.onBlur(); }) |
| 192 | + .on('focus.autocomplete', function () { that.onFocus(); }) |
| 193 | + .on('change.autocomplete', function (e) { that.onKeyUp(e); }) |
| 194 | + .on('input.autocomplete', function (e) { that.onKeyUp(e); }); |
193 | 195 | }, |
194 | 196 |
|
195 | 197 | onFocus: function () { |
|
0 commit comments