godoc/static: clean up the expandos code that handles the hash

Change-Id: I14e6777f781253a574f76c7d8a345d248b5a4306
Reviewed-on: https://go-review.googlesource.com/36320
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Chris Broadfoot 2017-02-03 19:16:49 -08:00
parent 7e08f6711b
commit 1a60337c22
2 changed files with 16 additions and 4 deletions

View File

@ -245,9 +245,15 @@ function fixFocus() {
}
function toggleHash() {
var id = window.location.hash.substring(1);
// Open all of the toggles for a particular hash.
var els = $(document.getElementById(window.location.hash.substring(1)),
$.find("a[name='" + window.location.hash.substring(1) + "']"));
var els = $(
document.getElementById(id),
$('a[name]').filter(function() {
return $(this).attr('name') == id;
})
);
while (els.length) {
for (var i = 0; i < els.length; i++) {
var el = $(els[i]);

View File

@ -815,9 +815,15 @@ function fixFocus() {
}
function toggleHash() {
var id = window.location.hash.substring(1);
// Open all of the toggles for a particular hash.
var els = $(document.getElementById(window.location.hash.substring(1)),
$("a[name='" + window.location.hash.substring(1) + "']"));
var els = $(
document.getElementById(id),
$('a[name]').filter(function() {
return $(this).attr('name') == id;
})
);
while (els.length) {
for (var i = 0; i < els.length; i++) {
var el = $(els[i]);