From 8e340695c15715ecd226c047e360d2e58af3f63e Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Mon, 2 May 2011 18:07:11 -0700 Subject: [PATCH] godoc: if there is no search box, don't run the respective JS code Fixes a JS crash which prevented the automatically generated table of contents to not appear. R=adg, bradfitz CC=golang-dev https://golang.org/cl/4460041 --- doc/godocs.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/godocs.js b/doc/godocs.js index 2b3ab065ff6..20ee36350d2 100644 --- a/doc/godocs.js +++ b/doc/godocs.js @@ -28,6 +28,10 @@ function godocs_onload() { function godocs_bindSearchEvents() { var search = document.getElementById('search'); + if (!search) { + // no search box (index disabled) + return; + } function clearInactive() { if (search.className == "inactive") { search.value = "";