e2c6af507b9d46c00083b9d560f643ee5f74e688 max Fri Sep 25 13:11:31 2026 -0700 hgSearch: fix JS error clicking MANE search result links, refs #38285 diff --git src/hg/js/hgSearch.js src/hg/js/hgSearch.js index c775ea590b9..0405e8629f7 100644 --- src/hg/js/hgSearch.js +++ src/hg/js/hgSearch.js @@ -883,31 +883,34 @@ // reload the page to attach curated hub (if any) re = /db=[\w,\.]*/; window.location = window.location.href.replace(re,"db="+newDb); } function saveLinkClicks() { // attach the link handlers to save search history document.querySelectorAll(".searchResult>a").forEach(function(i,j,k) { i.addEventListener("click", function(e) { // i is the element, use parent elements and the href // to construct a fake autocomplete option and save it e.preventDefault(); // stops the page from redirecting until this function finishes let callbackData = {}; let trackName = i.parentNode.parentNode.parentNode.id.replace(/Results$/,""); let matchList = uiState.positionMatches.find((matches) => matches.name === trackName); - let id, match, matchStr = i.childNodes[0].textContent; + // use the full link text, not just the first child node: a MANE + // transcript link has a "MANE Select: " text node before the + // bolded accession, so childNodes[0] alone would miss the accession + let id, match, matchStr = i.textContent; // switch lookup depending on the different search categories: let decoder = function(str) { // helper decoder to change the html encoded entities in // uiState.positionMatches.posName to what is actually rendered // in matchStr return $("