about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-11-22 06:28:11 +0000
committerbors <bors@rust-lang.org>2021-11-22 06:28:11 +0000
commit80f5f600194061e196557fb54ca5cca9c8a345db (patch)
tree047f88c762c94c8ebdf98ab2228cda24d0ad25ef
parentf7c48297ce21ac0dc5b36ff730377bdb7be6ece4 (diff)
parent88787a33a7325e5444e0151c6a75558b0c514234 (diff)
downloadrust-80f5f600194061e196557fb54ca5cca9c8a345db.tar.gz
rust-80f5f600194061e196557fb54ca5cca9c8a345db.zip
Auto merge of #90872 - ken-matsui:add-defer-to-rustdoc-template, r=jsha
Move `scripts` on the rustdoc template into `head` and apply the `defer` attribute

Closes https://github.com/rust-lang/rust/issues/90719
-rw-r--r--src/librustdoc/html/templates/page.html20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/librustdoc/html/templates/page.html b/src/librustdoc/html/templates/page.html
index 9fafea69145..cf57d4cf3aa 100644
--- a/src/librustdoc/html/templates/page.html
+++ b/src/librustdoc/html/templates/page.html
@@ -20,6 +20,16 @@
     ></script> {#- -#}
     <script src="{{static_root_path | safe}}storage{{page.resource_suffix}}.js"></script> {#- -#}
     <script src="{{page.root_path | safe}}crates{{page.resource_suffix}}.js"></script> {#- -#}
+    <script defer src="{{static_root_path | safe}}main{{page.resource_suffix}}.js"></script> {#- -#}
+    {%- for script in page.static_extra_scripts -%}
+    <script defer src="{{static_root_path | safe}}{{script}}.js"></script> {#- -#}
+    {% endfor %}
+    {%- if layout.scrape_examples_extension -%}
+    <script defer src="{{page.root_path | safe}}scrape-examples{{page.resource_suffix}}.js"></script> {#- -#}
+    {%- endif -%}
+    {%- for script in page.extra_scripts -%}
+    <script defer src="{{page.root_path | safe}}{{script}}.js"></script> {#- -#}
+    {% endfor %}
     <noscript> {#- -#}
         <link rel="stylesheet" {# -#}
            href="{{static_root_path | safe}}noscript{{page.resource_suffix}}.css"> {#- -#}
@@ -107,15 +117,5 @@
          data-search-index-js="{{page.root_path | safe}}search-index{{page.resource_suffix}}.js" {# -#}
          data-search-js="{{static_root_path | safe}}search{{page.resource_suffix}}.js"> {#- -#}
     </div>
-    <script src="{{static_root_path | safe}}main{{page.resource_suffix}}.js"></script> {#- -#}
-    {%- for script in page.static_extra_scripts -%}
-    <script src="{{static_root_path | safe}}{{script}}.js"></script> {#- -#}
-    {% endfor %}
-    {%- if layout.scrape_examples_extension -%}
-    <script src="{{page.root_path | safe}}scrape-examples{{page.resource_suffix}}.js"></script> {#- -#}
-    {%- endif -%}
-    {%- for script in page.extra_scripts -%}
-    <script src="{{page.root_path | safe}}{{script}}.js"></script> {#- -#}
-    {% endfor %}
 </body> {#- -#}
 </html> {#- -#}