about summary refs log tree commit diff
path: root/src/librustdoc/html
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-05-22 07:19:01 +0200
committerGitHub <noreply@github.com>2025-05-22 07:19:01 +0200
commit981bbf41974a0f1aa4e2dfed1ea0955906d592a2 (patch)
tree415c5cac7def21b2c72bc45e1ef97ff961ba4db8 /src/librustdoc/html
parentcc87ae85dd689abeba40efa1a7761300e14908f4 (diff)
parent4516a5b96bbf8ba39dd74913aac7297c0c0f2ab6 (diff)
downloadrust-981bbf41974a0f1aa4e2dfed1ea0955906d592a2.tar.gz
rust-981bbf41974a0f1aa4e2dfed1ea0955906d592a2.zip
Rollup merge of #140868 - SpecificProtagonist:rustdoc-trait-impl-code-link, r=notriddle
rustdoc: Fix links with inline code in trait impl docs

Fixes #140857
Diffstat (limited to 'src/librustdoc/html')
-rw-r--r--src/librustdoc/html/static/js/main.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js
index a7ce2bf9048..7b1a61a3ffa 100644
--- a/src/librustdoc/html/static/js/main.js
+++ b/src/librustdoc/html/static/js/main.js
@@ -1179,8 +1179,10 @@ function preLoadCss(cssUrl) {
 
     onEachLazy(document.querySelectorAll(".toggle > summary:not(.hideme)"), el => {
         // @ts-expect-error
+        // Clicking on the summary's contents should not collapse it,
+        // but links within should still fire.
         el.addEventListener("click", e => {
-            if (e.target.tagName !== "SUMMARY" && e.target.tagName !== "A") {
+            if (!e.target.matches("summary, a, a *")) {
                 e.preventDefault();
             }
         });