From 47c59028b3d70be388600df301575a4afdf90388 Mon Sep 17 00:00:00 2001 From: Daniel McCloy Date: Tue, 4 Jun 2024 16:44:31 -0500 Subject: [PATCH 1/2] guard a couple (possibly null) querySelector results --- .../assets/scripts/pydata-sphinx-theme.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js b/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js index c3b1c85b7..3a0518d25 100644 --- a/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js +++ b/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js @@ -775,7 +775,7 @@ function debounce(callback, wait) { */ async function setupAnnouncementBanner() { const banner = document.querySelector(".bd-header-announcement"); - const { pstAnnouncementUrl } = banner.dataset; + const { pstAnnouncementUrl } = banner ? banner.dataset : null; if (!pstAnnouncementUrl) { return; @@ -812,6 +812,9 @@ async function fetchRevealBannersTogether() { // to hidden, and an animation transition on the height (unless the user has // turned off animations) const revealer = document.querySelector(".pst-async-banner-revealer"); + if (!revealer) { + return + } // Remove the d-none (display-none) class to calculate the children heights. revealer.classList.remove("d-none"); From e2bc565654439e1957160177ee0303c3b70e031c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 4 Jun 2024 21:47:26 +0000 Subject: [PATCH 2/2] [pre-commit.ci] Automatic linting and formatting fixes --- src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js b/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js index 3a0518d25..63a5d861e 100644 --- a/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js +++ b/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js @@ -813,7 +813,7 @@ async function fetchRevealBannersTogether() { // turned off animations) const revealer = document.querySelector(".pst-async-banner-revealer"); if (!revealer) { - return + return; } // Remove the d-none (display-none) class to calculate the children heights.