From bfa9972d7fe9ab66967868ed4fccbaea00931735 Mon Sep 17 00:00:00 2001 From: Barry Pollard Date: Wed, 15 Apr 2020 21:05:38 +0100 Subject: [PATCH] Add test for index (#734) --- src/static/js/chapter.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/static/js/chapter.js b/src/static/js/chapter.js index 0840178e84e..b4dcf1c9a0c 100644 --- a/src/static/js/chapter.js +++ b/src/static/js/chapter.js @@ -265,6 +265,11 @@ function indexHighlighter() { var chapterIndex = document.querySelector('.index-box'); + // If not index - then nothing to do! + if (!chapterIndex) { + return; + } + // Check if user has set reduced motion and only continue if not var hasOSReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; if (hasOSReducedMotion) {