From 2ad87dbff6e2c0aebfa46ddc7d7a5c3b998dba9f Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 30 Aug 2020 16:55:53 +1000 Subject: [PATCH] [matrix] Fix JS errors on search results page --- docs/_static/custom.js | 4 ++-- docs/_static/sidebar.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/_static/custom.js b/docs/_static/custom.js index 95d1539b2..b3712f4ad 100644 --- a/docs/_static/custom.js +++ b/docs/_static/custom.js @@ -25,7 +25,7 @@ class Modal { } } -class Search { +class SearchBar { constructor() { this.box = document.querySelector('nav.mobile-only'); @@ -50,7 +50,7 @@ class Search { } document.addEventListener('DOMContentLoaded', () => { - mobileSearch = new Search(); + mobileSearch = new SearchBar(); bottomHeightThreshold = document.documentElement.scrollHeight - 30; sections = document.querySelectorAll('section'); diff --git a/docs/_static/sidebar.js b/docs/_static/sidebar.js index a08a3f213..c44518f54 100644 --- a/docs/_static/sidebar.js +++ b/docs/_static/sidebar.js @@ -23,6 +23,9 @@ class Sidebar { createCollapsableSections() { let toc = this.element.querySelector('ul'); + if (!toc) { + return + } let allReferences = toc.querySelectorAll('a.reference.internal:not([href="#"])'); for (let ref of allReferences) {