Skip to content

Commit 0959149

Browse files
committed
rustdoc: remove inline javascript from copy-path button
1 parent 7919ef0 commit 0959149

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,11 @@ function loadCss(cssUrl) {
11421142
(function() {
11431143
let reset_button_timeout = null;
11441144

1145-
window.copy_path = but => {
1145+
const but = document.getElementById("copy-path");
1146+
if (!but) {
1147+
return;
1148+
}
1149+
but.onclick = () => {
11461150
const parent = but.parentElement;
11471151
const path = [];
11481152

src/librustdoc/html/templates/print_item.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ <h1> {#- -#}
66
<a href="{{component.path|safe}}index.html">{{component.name}}</a>::<wbr>
77
{%- endfor -%}
88
<a class="{{item_type}}" href="#">{{name}}</a> {#- -#}
9-
<button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"> {#- -#}
9+
<button id="copy-path" title="Copy item path to clipboard"> {#- -#}
1010
<img src="{{static_root_path|safe}}{{clipboard_svg}}" {# -#}
1111
width="19" height="18" {# -#}
1212
alt="Copy item path"> {#- -#}

0 commit comments

Comments
 (0)