From 0959149323bd025905cd8b2572426e6fe443b420 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Fri, 27 Jan 2023 14:23:28 -0700 Subject: [PATCH] rustdoc: remove inline javascript from copy-path button --- src/librustdoc/html/static/js/main.js | 6 +++++- src/librustdoc/html/templates/print_item.html | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 604ab147f6a..b9ad8ef70e9 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -1142,7 +1142,11 @@ function loadCss(cssUrl) { (function() { let reset_button_timeout = null; - window.copy_path = but => { + const but = document.getElementById("copy-path"); + if (!but) { + return; + } + but.onclick = () => { const parent = but.parentElement; const path = []; diff --git a/src/librustdoc/html/templates/print_item.html b/src/librustdoc/html/templates/print_item.html index ee2880bf6d1..3a1867b7feb 100644 --- a/src/librustdoc/html/templates/print_item.html +++ b/src/librustdoc/html/templates/print_item.html @@ -6,7 +6,7 @@ {{component.name}}:: {%- endfor -%} {{name}} {#- -#} -