-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Description
The generated page HTML contains a <div> tag in the header, which is not valid as per the HTML spec (which only allows "Metadata content"). This has been the case since #106915, which moved this div from the body to the header.
I believe browsers will open the body if an invalid tag is encountered in the header (which you can see in inspect elements, where every item in between </div> </head> are inside of <body>), or something like that.
This causes at least one bug: the #![doc(html_favicon_url = "...")] attribute, which expands into a <link rel="icon" href="...">, is not displayed on Chrome and Chromium-based browsers.
You can see this in the time crate on docs.rs:
Generated HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- ... -->
<div id="rustdoc-vars"
<!-- ... -->
<link rel="icon" href="https://avatars0.githubusercontent.com/u/55999857">
<!-- ... -->
</head>vs inspect element:
<html lang="en" data-theme="light">
<head>
<meta charset="utf-8">
<!-- ... -->
</head>
<div style="display: none; position: fixed; width: 100%; height: 100%; z-index: 1;"></div>
<body class="rustdoc-page">
<div id="rustdoc-vars"
<!-- ... -->
<link rel="icon" href="https://avatars0.githubusercontent.com/u/55999857">
<!-- ... -->
</body>Manually moving the link tag to the header correctly displays the favicon:



