about summary refs log tree commit diff
path: root/src/librustdoc/html/static/js/src-script.js
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-02-07 17:50:08 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-02-10 18:50:05 +0100
commit0395fc2242c2b04f3a0a330e2e1f6eeaf5939777 (patch)
tree34f9b991eb41afe759ca65bd1dff69d272e363d1 /src/librustdoc/html/static/js/src-script.js
parent8c04e395952022a451138dc4dbead6dd6ae65203 (diff)
downloadrust-0395fc2242c2b04f3a0a330e2e1f6eeaf5939777.tar.gz
rust-0395fc2242c2b04f3a0a330e2e1f6eeaf5939777.zip
Move line numbers into the `<code>` directly
Diffstat (limited to 'src/librustdoc/html/static/js/src-script.js')
-rw-r--r--src/librustdoc/html/static/js/src-script.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/librustdoc/html/static/js/src-script.js b/src/librustdoc/html/static/js/src-script.js
index 8f712f4c20c..fc27241334b 100644
--- a/src/librustdoc/html/static/js/src-script.js
+++ b/src/librustdoc/html/static/js/src-script.js
@@ -138,10 +138,8 @@ function highlightSrcLines() {
     if (x) {
         x.scrollIntoView();
     }
-    onEachLazy(document.getElementsByClassName("src-line-numbers"), e => {
-        onEachLazy(e.getElementsByTagName("a"), i_e => {
-            removeClass(i_e, "line-highlighted");
-        });
+    onEachLazy(document.querySelectorAll("a[data-nosnippet]"), e => {
+        removeClass(e, "line-highlighted");
     });
     for (let i = from; i <= to; ++i) {
         elem = document.getElementById(i);
@@ -200,7 +198,7 @@ const handleSrcHighlight = (function() {
 
 window.addEventListener("hashchange", highlightSrcLines);
 
-onEachLazy(document.getElementsByClassName("src-line-numbers"), el => {
+onEachLazy(document.querySelectorAll("a[data-nosnippet]"), el => {
     el.addEventListener("click", handleSrcHighlight);
 });