From 67b64d60ecaeb058192591873d4f1b3da0fc9035 Mon Sep 17 00:00:00 2001 From: s-pace Date: Fri, 2 Nov 2018 10:03:22 +0100 Subject: [PATCH] better management of selector matching plenty element, we only take the first one --- src/lib/DocSearch.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/DocSearch.js b/src/lib/DocSearch.js index dcd7122a..e59043ed 100644 --- a/src/lib/DocSearch.js +++ b/src/lib/DocSearch.js @@ -184,9 +184,13 @@ class DocSearch { } else { const selectors = selector.split(','); if (selectors.length === 1) { - return [$(selector).filter('input')]; + const input = $(selector).filter('input'); + return input.length ? [$(input[0])] : null; } else { - return selectors.map(s => $(s).filter('input')); + return selectors.map(s => { + const input = $(s).filter('input'); + return input.length ? $(input[0]) : null; + }); } } }