160d10a30597d7435c30409878e2ba11c3e7c660
mspeir
Wed Sep 9 14:19:40 2026 -0700
trackDb docs: stop the shared script from aborting on the pages without a search box, refs #38062
Two JavaScript faults on the trackDb doc pages, both of which trackDbHub.v3.html
had already avoided while the other pages drifted.
trackDbDoc.html, changes.html and trackDbHub.v0/v1/v2.html load /js/utils.js in
their head, and the hgMenubar include further down brings in the same file by a
different path, so it ran twice. utils.js declares mouseoverContainer with let
at top level, so the second run threw a redeclaration error. v3 does not load
utils.js in the head, and the menubar copy is in place well before anything
needs it, so drop the head copy from the other five.
documentLoad() then called addEventListener on the result of
getElementById("tdbSearch") with no null check, and only v3 has that input, so
the function threw partway through on the other four pages and never reached
its end. The search box and jump-to-top button do not exist on those pages, so
nothing visible was lost, but the exception aborted the rest of documentLoad
and would have swallowed anything added after it. Guard the two listeners.
All six pages now load with no console errors, checked in a browser.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
diff --git src/hg/htdocs/goldenPath/help/trackDb/trackDbHub.v1.html src/hg/htdocs/goldenPath/help/trackDb/trackDbHub.v1.html
index 4eb5f19adf9..21724305fec 100755
--- src/hg/htdocs/goldenPath/help/trackDb/trackDbHub.v1.html
+++ src/hg/htdocs/goldenPath/help/trackDb/trackDbHub.v1.html
@@ -1,27 +1,26 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<META name="description" content="UCSC Track Database Definition">
<META name="keywords" content="tracDb, tracks, UCSC, bioinformatics">
<TITLE>UCSC Track Database Definition</TITLE>
<LINK REL="STYLESHEET" HREF="/style/HGStyle.css">
<LINK REL="STYLESHEET" HREF="trackDbDoc.css">
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/staticDoc.js"></script>
- <script type="text/javascript" src="/js/utils.js"></script>
<script type="text/javascript" src="trackDbDoc.js"></script>
<script type="text/javascript">
$(document).ready(function() {
//tdbDoc.library.checkup(); // Run this test during development only
// TOC Self assembly EXPERIMENTAL
tdbDoc.tocAssemble( 0, ["bed_flavors","parent_supertrack",
"parent_view","parent_container"] );
tdbDoc.documentLoad();
});
</script>
</HEAD>
<BODY>
<A NAME="TOP"></A>