diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-01-28 11:11:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-28 11:11:09 +0100 |
| commit | 6bd09e0cd66a085e14103b1bda84287bdf1f44b2 (patch) | |
| tree | 930eeeeb15251de09e33b1394023ca697406605f | |
| parent | 18c9c643c136f64d57f7ba549f9f536110fd39fa (diff) | |
| parent | 0959149323bd025905cd8b2572426e6fe443b420 (diff) | |
| download | rust-6bd09e0cd66a085e14103b1bda84287bdf1f44b2.tar.gz rust-6bd09e0cd66a085e14103b1bda84287bdf1f44b2.zip | |
Rollup merge of #107391 - notriddle:notriddle/copy-path-button, r=GuillaumeGomez
rustdoc: remove inline javascript from copy-path button
| -rw-r--r-- | src/librustdoc/html/static/js/main.js | 6 | ||||
| -rw-r--r-- | 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 @@ <a href="{{component.path|safe}}index.html">{{component.name}}</a>::<wbr> {%- endfor -%} <a class="{{item_type}}" href="#">{{name}}</a> {#- -#} - <button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"> {#- -#} + <button id="copy-path" title="Copy item path to clipboard"> {#- -#} <img src="{{static_root_path|safe}}{{clipboard_svg}}" {# -#} width="19" height="18" {# -#} alt="Copy item path"> {#- -#} |
