Skip to content

Commit

Permalink
Replace document.write with document.head.insertAdjacent
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Apr 11, 2024
1 parent 5974fe8 commit 7b6f3ee
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/librustdoc/html/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
<meta name="description" content="{{page.description}}"> {# #}
<title>{{page.title}}</title> {# #}
<script>if(window.location.protocol!=="file:") {# Hack to skip preloading fonts locally - see #98769 #}
for(f of "{{files.source_serif_4_regular}},{{files.fira_sans_regular}},{{files.fira_sans_medium}},{{files.source_code_pro_regular}},{{files.source_code_pro_semibold}}".split(",")) {# #}
document.write(`<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path|safe}}${f}">`) {# #}
document.head.insertAdjacent("beforeend","{{files.source_serif_4_regular}},{{files.fira_sans_regular}},{{files.fira_sans_medium}},{{files.source_code_pro_regular}},{{files.source_code_pro_semibold}}".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="{{static_root_path|safe}}${f}">`)) {# #}
</script> {# #}
<link rel="stylesheet" {#+ #}
href="{{static_root_path|safe}}{{files.normalize_css}}"> {# #}
Expand Down

0 comments on commit 7b6f3ee

Please sign in to comment.