]> Cypherpunks repositories - gostls13.git/commitdiff
godoc: if there is no search box, don't run the respective JS code
authorRobert Griesemer <gri@golang.org>
Tue, 3 May 2011 01:07:11 +0000 (18:07 -0700)
committerRobert Griesemer <gri@golang.org>
Tue, 3 May 2011 01:07:11 +0000 (18:07 -0700)
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

index 2b3ab065ff60e92a21e5d8edd4485692aaf7e5fd..20ee36350d2343ebe15c5a6699ecd201d6d04a7f 100644 (file)
@@ -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 = "";