From f5558e0e57199138ebda183152c3a008d7d34eb4 Mon Sep 17 00:00:00 2001 From: DiamondYuan <541832074@qq.com> Date: Thu, 15 Mar 2018 04:45:05 +0800 Subject: [PATCH] Fix js error in homepage (#7680) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When document.querySelector('#docsToc') is null ,get TypeError Cannot read property 'querySelector' of null 。 --- _includes/footer-scripts.html | 1 + 1 file changed, 1 insertion(+) diff --git a/_includes/footer-scripts.html b/_includes/footer-scripts.html index 091545d12a..07f1e86bd8 100644 --- a/_includes/footer-scripts.html +++ b/_includes/footer-scripts.html @@ -32,6 +32,7 @@ ga('send', 'pageview'); function hideNav(toc){ if (!toc) toc = document.querySelector('#docsToc') + if (!toc) return var container = toc.querySelector('.container') // container is built dynamically, so it may not be present on the first runloop