Rollup merge of #107391 - notriddle:notriddle/copy-path-button, r=GuillaumeGomez

rustdoc: remove inline javascript from copy-path button
This commit is contained in:
Matthias Krüger 2023-01-28 11:11:09 +01:00 committed by GitHub
commit 6bd09e0cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -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 = [];

View File

@ -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"> {#- -#}