@@ -177,59 +177,62 @@ var autoSuggest = (function() {
177177 fontawesomeIcon : function ( ) {
178178 suggestItems . forEach ( function ( arrayItem ) {
179179 var li = helper . node ( "li|class:auto-suggest-list-item" ) ;
180- var anchor = helper . node ( "a|href:#, tabindex:1,class:auto-suggest-link " ) ;
180+ var button = helper . node ( "button| tabindex:1,class:auto-suggest-item " ) ;
181181 var icon = helper . node ( "span|class:auto-suggest-icon fa-" + arrayItem . name ) ;
182182 if ( arrayItem . styles . includes ( "solid" ) ) {
183183 helper . addClass ( icon , "fas" ) ;
184184 } else if ( arrayItem . styles . includes ( "brands" ) ) {
185185 helper . addClass ( icon , "fab" ) ;
186186 } ;
187- anchor . addEventListener ( "click" , function ( ) {
187+ button . addEventListener ( "click" , function ( ) {
188188 link . render . autoSuggestIconAction ( arrayItem ) ;
189189 } , false ) ;
190190 var text = helper . node ( "span:" + arrayItem . label + "|class:auto-suggest-icon-text" ) ;
191- anchor . appendChild ( icon ) ;
192- anchor . appendChild ( text ) ;
193- li . appendChild ( anchor ) ;
191+ button . appendChild ( icon ) ;
192+ button . appendChild ( text ) ;
193+ li . appendChild ( button ) ;
194194 list . appendChild ( li ) ;
195195 } ) ;
196196 }
197197 } ;
198198 action [ _currentInputOptions . type ] ( ) ;
199199 } ;
200- var _renderAutoSuggestList = function ( ) {
201- var autoSuggestWrapper = helper . e ( ".auto-suggest-wrapper" ) ;
200+ var _renderAutoSuggest = function ( ) {
201+ var autoSuggestInput = helper . e ( ".auto-suggest-input" ) ;
202+ var autoSuggest = helper . e ( ".auto-suggest" ) ;
202203 var autoSuggestList = helper . e ( ".auto-suggest-list" ) ;
203- if ( autoSuggestList ) {
204+ if ( autoSuggest ) {
204205 while ( autoSuggestList . lastChild ) {
205206 autoSuggestList . removeChild ( autoSuggestList . lastChild ) ;
206207 } ;
207208 } else {
208- var style = {
209- left : autoSuggestWrapper . getBoundingClientRect ( ) . left ,
210- top : autoSuggestWrapper . getBoundingClientRect ( ) . bottom + window . scrollY ,
211- width : autoSuggestWrapper . getBoundingClientRect ( ) . width
209+ var box = {
210+ left : autoSuggestInput . getBoundingClientRect ( ) . left ,
211+ top : autoSuggestInput . getBoundingClientRect ( ) . bottom + window . scrollY ,
212+ width : autoSuggestInput . getBoundingClientRect ( ) . width
212213 } ;
214+ var autoSuggest = helper . node ( "div|class:auto-suggest list-unstyled" ) ;
213215 var autoSuggestList = helper . node ( "ul|class:auto-suggest-list list-unstyled" ) ;
214- body . appendChild ( autoSuggestList ) ;
215- autoSuggestList . setAttribute ( "style" , "width: " + style . width + "px; top: " + style . top + "px; left: " + style . left + "px;" ) ;
216+ autoSuggest . appendChild ( autoSuggestList ) ;
217+ body . appendChild ( autoSuggest ) ;
218+ autoSuggest . setAttribute ( "style" , "width: " + box . width + "px; top: " + box . top + "px; left: " + box . left + "px;" ) ;
216219 documentEvent . add ( ) ;
217220 } ;
218221 _populateList ( autoSuggestList ) ;
219222 } ;
220223 if ( suggestItems . length > 0 ) {
221224 _autoSuggestActive = true ;
222- _renderAutoSuggestList ( ) ;
225+ _renderAutoSuggest ( ) ;
223226 } else {
224227 render . close ( ) ;
225228 } ;
226229 } ;
227230
228231 render . close = function ( ) {
229232 mod . close ( ) ;
230- var autoSuggestList = helper . e ( ".auto-suggest-list " ) ;
231- if ( autoSuggestList ) {
232- autoSuggestList . remove ( ) ;
233+ var autoSuggest = helper . e ( ".auto-suggest" ) ;
234+ if ( autoSuggest ) {
235+ autoSuggest . remove ( ) ;
233236 documentEvent . remove ( ) ;
234237 _currentInputOptions = { } ;
235238 _autoSuggestActive = false ;
0 commit comments