Skip to content

Commit

Permalink
rustdoc: remove inline javascript from copy-path button
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Jan 27, 2023
1 parent 7919ef0 commit 0959149
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/librustdoc/html/static/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/templates/print_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h1> {#- -#}
<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"> {#- -#}
Expand Down

0 comments on commit 0959149

Please sign in to comment.