]> 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)
committerXhmikosR <xhmikosr@gmail.com>
Fri, 13 Nov 2020 10:50:13 +0000 (12:50 +0200)
site/docs/4.5/assets/js/src/search.js

index bb97c5cf80c1504c9543e1722aa0cf5d0e80dd18..724c6aa33422b15372288e5c007424f9995ed80d 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')
 
   function getOrigin() {