Skip to content

Commit 96d3414

Browse files
allow any link children
1 parent fe4b9ef commit 96d3414

File tree

1 file changed

+3
-5
lines changed
  • src/librustdoc/html/static/js

1 file changed

+3
-5
lines changed

src/librustdoc/html/static/js/main.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -1080,12 +1080,10 @@ function preLoadCss(cssUrl) {
10801080
});
10811081

10821082
onEachLazy(document.querySelectorAll(".toggle > summary:not(.hideme)"), el => {
1083+
// Clicking on the summary's contents should not collapse it,
1084+
// but links within should still fire.
10831085
el.addEventListener("click", e => {
1084-
if (
1085-
e.target.tagName !== "SUMMARY"
1086-
&& e.target.tagName !== "A"
1087-
&& !(e.target.tagName === "CODE" && e.target.parentNode.tagName === "A")
1088-
) {
1086+
if (!e.target.matches("summary, a, a *")) {
10891087
e.preventDefault();
10901088
}
10911089
});

0 commit comments

Comments
 (0)