about summary refs log tree commit diff
path: root/src/librustdoc/html/static/js
diff options
context:
space:
mode:
authorbinarycat <binarycat@envs.net>2025-03-10 13:54:02 -0500
committerbinarycat <binarycat@envs.net>2025-03-10 15:00:35 -0500
commitab180c29e36504b4faed64dbffb29fbeca71e61c (patch)
tree8e8b5c4e73d5bd19e8e4a3939612ea688883e92e /src/librustdoc/html/static/js
parentf5efd2aba3003aff5461ce6495558a7dad0a3923 (diff)
downloadrust-ab180c29e36504b4faed64dbffb29fbeca71e61c.tar.gz
rust-ab180c29e36504b4faed64dbffb29fbeca71e61c.zip
main.js: handle document.activeElement being null
this is technically possible if someone sticks rustdoc in
an iframe, i think?
Diffstat (limited to 'src/librustdoc/html/static/js')
-rw-r--r--src/librustdoc/html/static/js/main.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js
index 3fdff21e591..755b999e171 100644
--- a/src/librustdoc/html/static/js/main.js
+++ b/src/librustdoc/html/static/js/main.js
@@ -538,8 +538,8 @@ function preLoadCss(cssUrl) {
             return;
         }
 
-        // @ts-expect-error
-        if (document.activeElement.tagName === "INPUT" &&
+        if (document.activeElement &&
+            document.activeElement.tagName === "INPUT" &&
             // @ts-expect-error
             document.activeElement.type !== "checkbox" &&
             // @ts-expect-error