apply null/undefined checks in website static js
MODIFY
website/static/js/index.js
website/static/js/index.js
@@ -63,13 +63,14 @@ const toc = {
start -= toc.getMobileNavbarHeight();
end -= toc.getMobileNavbarHeight();
-
+ if (link) {
if (scrollY > start && scrollY < end) {
link.classList.add("active");
} else {
link.classList.remove("active");
}
}
+ }
},
handleClick(event) {
const target = event.target;
@@ -204,10 +205,12 @@ elements.overlay.addEventListener("touchstart", mobileToggleEvent, false);
window.addEventListener("scroll", handleScroll, false);
elements.colorSchemeSwitch.addEventListener("click", modeSwitch, false);
-const teamArr = Array.from(elements.teamList.getElementsByTagName("li"));
-for (const li of randomShuffle(teamArr)) {
+const teamArr = document.querySelectorAll(".team-list li");
+if (teamArr.length > 0) {
+ for (const li of randomShuffle(Array.from(teamArr))) {
elements.teamList.appendChild(li);
}
+}
const homepageExample = document.querySelector(".homepage-example");
if (homepageExample != null) {

apply null/undefined checks in website static js (#817)

Co-authored-by: aravind reddy <aparapatakam@aconex.com>