]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
search.js: check for `search-input` element early (#32100)
authorXhmikosR <xhmikosr@gmail.com>
Mon, 9 Nov 2020 18:47:02 +0000 (20:47 +0200)
committerGitHub <noreply@github.com>
Mon, 9 Nov 2020 18:47:02 +0000 (20:47 +0200)
site/assets/js/search.js

index 2cf4c87878e1bbc170d9ea20b3851d51023fb290..14c138fa5b44efbaccd3d234ad9faa98cc2a5aaf 100644 (file)
@@ -5,11 +5,12 @@
 (function () {
   'use strict'
 
-  if (!window.docsearch) {
+  var inputElement = document.getElementById('search-input')
+
+  if (!window.docsearch || !inputElement) {
     return
   }
 
-  var inputElement = document.getElementById('search-input')
   var siteDocsVersion = inputElement.getAttribute('data-docs-version')
 
   document.addEventListener('keydown', function (event) {