зеркало из https://github.com/golang/pkgsite.git
content/static: fix null reference errors in unit.js
Fixes golang/go#43434 Change-Id: I0af7549c9acdb16202d6d77ca2993eea6cb35f7f Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/293841 Trust: Jamal Carvalho <jamal@golang.org> Reviewed-by: Julie Qiu <julie@golang.org>
This commit is contained in:
Родитель
05df48e41c
Коммит
19ae0765f7
|
@ -45,7 +45,9 @@ if (readme && readmeContent && readmeOutline && readmeExpand.length && readmeCol
|
|||
readmeCollapse.addEventListener('click', e => {
|
||||
e.preventDefault();
|
||||
readme.classList.remove('UnitReadme--expanded');
|
||||
readmeExpand[1].scrollIntoView({ block: 'center' });
|
||||
if (readmeExpand[1]) {
|
||||
readmeExpand[1].scrollIntoView({ block: 'center' });
|
||||
}
|
||||
});
|
||||
readmeContent.addEventListener('keyup', e => {
|
||||
readme.classList.add('UnitReadme--expanded');
|
||||
|
@ -72,6 +74,6 @@ if (readmeOption && !readme) {
|
|||
}
|
||||
const unitDirectories = document.querySelector('.js-unitDirectories');
|
||||
const directoriesOption = document.querySelector('.js-directoriesOption');
|
||||
if (!unitDirectories) {
|
||||
if (!unitDirectories && directoriesOption) {
|
||||
directoriesOption.setAttribute('disabled', true);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче