about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2022-12-12 15:17:49 -0700
committerMichael Howell <michael@notriddle.com>2022-12-12 15:17:49 -0700
commit46b4a3b83148192fa4dc50bf1a751357ec7393aa (patch)
tree0217cbfbe1274f2dec27b45da6ebfad14f6635df
parent37d7de337903a558dbeb1e82c844fe915ab8ff25 (diff)
downloadrust-46b4a3b83148192fa4dc50bf1a751357ec7393aa.tar.gz
rust-46b4a3b83148192fa4dc50bf1a751357ec7393aa.zip
rustdoc: remove `type="text/css" from stylesheet links
MDN directly recommends this in <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link>,
since "CSS is the only stylesheet language used on the web."

Like 07a243b2a46384235d7e2c08688978b7cf018973, but a few places that were
missed the first time.
-rw-r--r--src/librustdoc/html/render/context.rs2
-rw-r--r--src/librustdoc/html/static/js/main.js1
-rw-r--r--src/librustdoc/markdown.rs2
3 files changed, 2 insertions, 3 deletions
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs
index 73690c86f4f..d4d3e4f6ea7 100644
--- a/src/librustdoc/html/render/context.rs
+++ b/src/librustdoc/html/render/context.rs
@@ -637,7 +637,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
                             You need to enable Javascript be able to update your settings.\
                         </section>\
                      </noscript>\
-                     <link rel=\"stylesheet\" type=\"text/css\" \
+                     <link rel=\"stylesheet\" \
                          href=\"{static_root_path}{settings_css}\">\
                      <script defer src=\"{static_root_path}{settings_js}\"></script>",
                     static_root_path = page.get_static_root_path(),
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js
index 152116089c7..3f97e4e2e39 100644
--- a/src/librustdoc/html/static/js/main.js
+++ b/src/librustdoc/html/static/js/main.js
@@ -184,7 +184,6 @@ function browserSupportsHistoryApi() {
 function loadCss(cssUrl) {
     const link = document.createElement("link");
     link.href = cssUrl;
-    link.type = "text/css";
     link.rel = "stylesheet";
     document.getElementsByTagName("head")[0].appendChild(link);
 }
diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs
index 044e051440c..5f4ad6d2aea 100644
--- a/src/librustdoc/markdown.rs
+++ b/src/librustdoc/markdown.rs
@@ -53,7 +53,7 @@ pub(crate) fn render<P: AsRef<Path>>(
 
     let mut css = String::new();
     for name in &options.markdown_css {
-        write!(css, r#"<link rel="stylesheet" type="text/css" href="{name}">"#)
+        write!(css, r#"<link rel="stylesheet" href="{name}">"#)
             .expect("Writing to a String can't fail");
     }