This repository was archived by the owner on Apr 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
app/code/Magento/Search/view/frontend/web Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -286,16 +286,17 @@ define([
286
286
$ . getJSON ( this . options . url , {
287
287
q : value
288
288
} , $ . proxy ( function ( data ) {
289
- $ . each ( data , function ( index , element ) {
290
- var html ;
291
- element . index = index ;
292
- html = template ( {
293
- data : element
289
+ if ( data . length ) {
290
+ $ . each ( data , function ( index , element ) {
291
+ var html ;
292
+
293
+ element . index = index ;
294
+ html = template ( {
295
+ data : element
296
+ } ) ;
297
+ dropdown . append ( html ) ;
294
298
} ) ;
295
- dropdown . append ( html ) ;
296
- } ) ;
297
299
298
- if ( dropdown . has ( 'li' ) . length ) {
299
300
this . responseList . indexList = this . autoComplete . html ( dropdown )
300
301
. css ( clonePosition )
301
302
. show ( )
@@ -322,7 +323,8 @@ define([
322
323
this . element . attr ( 'aria-activedescendant' , $ ( e . target ) . attr ( 'id' ) ) ;
323
324
} . bind ( this ) )
324
325
. on ( 'mouseout' , function ( e ) {
325
- if ( ! this . _getLastElement ( ) && this . _getLastElement ( ) . hasClass ( this . options . selectClass ) ) {
326
+ if ( ! this . _getLastElement ( ) &&
327
+ this . _getLastElement ( ) . hasClass ( this . options . selectClass ) ) {
326
328
$ ( e . target ) . removeClass ( this . options . selectClass ) ;
327
329
this . _resetResponseList ( false ) ;
328
330
}
You can’t perform that action at this time.
0 commit comments