|
93 | 93 | that.onChange = null;
|
94 | 94 | that.isLocal = false;
|
95 | 95 | that.suggestionsContainer = null;
|
| 96 | + that.innerContainer = null; |
96 | 97 | that.options = $.extend({}, defaults, options);
|
97 | 98 | that.classes = {
|
98 | 99 | selected: 'autocomplete-selected',
|
|
126 | 127 | suggestionSelector = '.' + that.classes.suggestion,
|
127 | 128 | selected = that.classes.selected,
|
128 | 129 | options = that.options,
|
129 |
| - container; |
| 130 | + container, |
| 131 | + innerContainer; |
130 | 132 |
|
131 | 133 | // Remove autocomplete attribute to prevent native suggestions:
|
132 | 134 | that.element.setAttribute('autocomplete', 'off');
|
|
138 | 140 | }
|
139 | 141 | };
|
140 | 142 |
|
141 |
| - that.suggestionsContainer = Autocomplete.utils.createNode('<div class="' + options.containerClass + '" style="position: absolute; display: none;"></div>'); |
| 143 | + that.suggestionsContainer = Autocomplete.utils.createNode('<div class="' + options.containerClass + '" style="position: absolute; display: none;"><div class="autocomplete-inner"></div></div>'); |
142 | 144 |
|
143 | 145 | container = $(that.suggestionsContainer);
|
144 |
| - |
145 | 146 | container.appendTo(options.appendTo);
|
146 | 147 |
|
| 148 | + that.innerContainer = $('.autocomplete-inner', container); |
| 149 | + |
147 | 150 | // Only set width if it was provided:
|
148 | 151 | if (options.width !== 'auto') {
|
149 | 152 | container.width(options.width);
|
|
473 | 476 | className = that.classes.suggestion,
|
474 | 477 | classSelected = that.classes.selected,
|
475 | 478 | container = $(that.suggestionsContainer),
|
| 479 | + innerContainer = that.innerContainer, |
476 | 480 | html = '',
|
477 | 481 | width;
|
478 | 482 |
|
|
490 | 494 | container.width(width > 0 ? width : 300);
|
491 | 495 | }
|
492 | 496 |
|
493 |
| - container.html(html).show(); |
| 497 | + innerContainer.html(html); |
| 498 | + container.show(); |
494 | 499 | that.visible = true;
|
495 | 500 |
|
496 | 501 | // Select first value by default:
|
497 | 502 | if (that.options.autoSelectFirst) {
|
498 | 503 | that.selectedIndex = 0;
|
499 |
| - container.children().first().addClass(classSelected); |
| 504 | + innerContainer.children().first().addClass(classSelected); |
500 | 505 | }
|
501 | 506 |
|
502 | 507 | that.findBestHint();
|
|
0 commit comments