summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorGustavo Sousa <gustavo.sousa@intel.com>2024-01-23 19:21:58 +0300
committerJonathan Corbet <corbet@lwn.net>2024-01-24 00:33:13 +0300
commitd2d0223441d3caad65f6978c07869321bce968e0 (patch)
treedfb30130bc9a4b26cc3bef30a45a4cdb406651d8 /Documentation
parent6613476e225e090cc9aad49be7fa504e290dd33d (diff)
downloadlinux-d2d0223441d3caad65f6978c07869321bce968e0.tar.xz
docs/sphinx: Fix TOC scroll hack for the home page
When on the documentation home page, there won't be any ".current" element since no entry from the TOC was selected yet. That results in a javascript error. Fix that by only trying to set the scrollTop if we have matches for current entries. Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/20240123162157.61819-2-gustavo.sousa@intel.com
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/sphinx/templates/kernel-toc.html4
1 files changed, 3 insertions, 1 deletions
diff --git a/Documentation/sphinx/templates/kernel-toc.html b/Documentation/sphinx/templates/kernel-toc.html
index b58efa99df52..41f1efbe64bb 100644
--- a/Documentation/sphinx/templates/kernel-toc.html
+++ b/Documentation/sphinx/templates/kernel-toc.html
@@ -12,5 +12,7 @@
<script type="text/javascript"> <!--
var sbar = document.getElementsByClassName("sphinxsidebar")[0];
let currents = document.getElementsByClassName("current")
- sbar.scrollTop = currents[currents.length - 1].offsetTop;
+ if (currents.length) {
+ sbar.scrollTop = currents[currents.length - 1].offsetTop;
+ }
--> </script>