go.dev: fix uncaught JS error
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:
Родитель
103d89b8bc
Коммит
4ff95d6465
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче