From 16790f903e4dbd52da779f246dd641bfef789c50 Mon Sep 17 00:00:00 2001 From: s-pace Date: Thu, 1 Nov 2018 22:23:05 +0100 Subject: [PATCH] removing handleSelected properly, make sure backward compatibility --- src/lib/DocSearch.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/lib/DocSearch.js b/src/lib/DocSearch.js index 4cd8d51b..844fccea 100644 --- a/src/lib/DocSearch.js +++ b/src/lib/DocSearch.js @@ -79,8 +79,6 @@ class DocSearch { this.autocompleteOptions.cssClasses.prefix || 'ds'; // eslint-disable-next-line no-param-reassign - handleSelected = handleSelected || this.handleSelected; - this.isSimpleLayout = layout === 'simple'; this.client = algoliasearch(this.appId, this.apiKey); @@ -100,10 +98,12 @@ class DocSearch { }, }, ]); - this.autocomplete.on( - 'autocomplete:selected', - handleSelected.bind(null, this.autocomplete.autocomplete) - ); + if (handleSelected) { + this.autocomplete.on( + 'autocomplete:selected', + handleSelected.bind(null, this.autocomplete.autocomplete) + ); + } this.autocomplete.on( 'autocomplete:shown', this.handleShown.bind(null, this.input) @@ -320,7 +320,6 @@ class DocSearch { middleOfInput - middleOfWindow < 0 ? 'algolia-autocomplete-right' : 'algolia-autocomplete-left'; - const autocompleteWrapper = $('.algolia-autocomplete'); if (!autocompleteWrapper.hasClass(alignClass)) { autocompleteWrapper.addClass(alignClass);