1
0
mirror of https://github.com/golang/go synced 2024-11-24 21:00:09 -07:00

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
This commit is contained in:
Robert Griesemer 2011-05-02 18:07:11 -07:00
parent bb7eb4002e
commit 8e340695c1

View File

@ -28,6 +28,10 @@ function godocs_onload() {
function godocs_bindSearchEvents() { function godocs_bindSearchEvents() {
var search = document.getElementById('search'); var search = document.getElementById('search');
if (!search) {
// no search box (index disabled)
return;
}
function clearInactive() { function clearInactive() {
if (search.className == "inactive") { if (search.className == "inactive") {
search.value = ""; search.value = "";