The searchBox.js code throws an error when no
search form is present on the page. Return early
when the form is not present to prevent the error.

Change-Id: I8a77d34fad185d5c59ab10bce88776d363bb3bef
Reviewed-on: https://go-review.googlesource.com/c/website/+/359215
Trust: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
This commit is contained in:
Jamal Carvalho 2021-10-27 19:05:47 +00:00
Родитель 103d89b8bc
Коммит 4ff95d6465
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -3,9 +3,11 @@
const BREAKPOINT = 512;
const logo = document.querySelector('.js-headerLogo');
const form = document.querySelector('.js-searchForm');
if (!form) return;
const button = document.querySelector('.js-searchFormSubmit');
const input = form.querySelector('input');
renderForm();
window.addEventListener('resize', renderForm);