-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve loading of crates.js and sidebar-items.js #98124
Conversation
Some changes occurred in HTML/CSS/JS. |
This comment has been minimized.
This comment has been minimized.
Looks great, thanks! r=me with CI fixed. |
Oh actually, on source code pages, you don't need to load |
This comment has been minimized.
This comment has been minimized.
I think you need to update the |
Apart from that, the simplification of the code is greatly appreciated, thanks for it! :) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Now that the "All Crates" dropdown is only rendered on the search results page, there is no need to load crates.js on most pages. Load it only on crate pages. Also, add the `defer` attribute so it does not block page rendering. For sidebar-items.js, move the script tag to `<head>`. Since it already has the defer attribute it won't block loading. The defer attribute does preserve ordering between scripts, so instead of the callback on load, it can set a global variable on load, which is slightly simpler. Also, since it is required to finish rendering the page, beginning its load earlier is better. Remove generation and handling of sidebar-vars. Everything there can be computed with information available in JS via other means. Remove the "other" wrapper in the sidebar. It was unnecessary. Remove excess script fields
@bors r=GuillaumeGomez rollup |
📌 Commit 27dcebe has been approved by |
Improve loading of crates.js and sidebar-items.js Now that the "All Crates" dropdown is only rendered on the search results page, there is no need to load crates.js on most pages. Load it only on crate pages. Also, add the `defer` attribute so it does not block HTML parsing. For sidebar-items.js, move the script tag to `<head>`. Since it already has the defer attribute it won't block loading. The defer attribute does preserve ordering between scripts, so instead of the callback on load, it can set a global variable on load, which is slightly simpler. Also, since it is required to finish rendering the page, beginning its load earlier is better. Remove generation and handling of sidebar-vars. Everything there can be computed with information available in JS via other means. Remove the extra_scripts fields of the `Page` template. They were only used by source-script.js and source-files.js, which are now linked by the template based on whether it is rendering a source page. Remove the "other" wrapper in the sidebar. It was unnecessary. r? `@GuillaumeGomez` Demo: https://rustdoc.crud.net/jsha/defer-crates/std/index.html
Improve loading of crates.js and sidebar-items.js Now that the "All Crates" dropdown is only rendered on the search results page, there is no need to load crates.js on most pages. Load it only on crate pages. Also, add the `defer` attribute so it does not block HTML parsing. For sidebar-items.js, move the script tag to `<head>`. Since it already has the defer attribute it won't block loading. The defer attribute does preserve ordering between scripts, so instead of the callback on load, it can set a global variable on load, which is slightly simpler. Also, since it is required to finish rendering the page, beginning its load earlier is better. Remove generation and handling of sidebar-vars. Everything there can be computed with information available in JS via other means. Remove the extra_scripts fields of the `Page` template. They were only used by source-script.js and source-files.js, which are now linked by the template based on whether it is rendering a source page. Remove the "other" wrapper in the sidebar. It was unnecessary. r? ``@GuillaumeGomez`` Demo: https://rustdoc.crud.net/jsha/defer-crates/std/index.html
Rollup of 11 pull requests Successful merges: - rust-lang#94033 (Improve docs for `is_running` to explain use case) - rust-lang#97269 (adjust transmute const stabilization version) - rust-lang#97805 (Add proper tracing spans to rustc_trait_selection::traits::error_reporting) - rust-lang#98022 (Fix erroneous span for borrowck error) - rust-lang#98124 (Improve loading of crates.js and sidebar-items.js) - rust-lang#98278 (Some token stream cleanups) - rust-lang#98306 (`try_fold_unevaluated` for infallible folders) - rust-lang#98313 (Remove lies in comments.) - rust-lang#98323 (:arrow_up: rust-analyzer) - rust-lang#98329 (Avoid an ICE and instead let the compiler report a useful error) - rust-lang#98330 (update ioslice docs to use shared slices) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Now that the "All Crates" dropdown is only rendered on the search results page,
there is no need to load crates.js on most pages. Load it only on crate pages.
Also, add the
defer
attribute so it does not block HTML parsing.For sidebar-items.js, move the script tag to
<head>
. Since it already has thedefer attribute it won't block loading. The defer attribute does preserve
ordering between scripts, so instead of the callback on load, it can set a
global variable on load, which is slightly simpler. Also, since it is required
to finish rendering the page, beginning its load earlier is better.
Remove generation and handling of sidebar-vars. Everything there can be computed
with information available in JS via other means.
Remove the extra_scripts fields of the
Page
template. They were onlyused by source-script.js and source-files.js, which are now linked by the template
based on whether it is rendering a source page.
Remove the "other" wrapper in the sidebar. It was unnecessary.
r? @GuillaumeGomez
Demo: https://rustdoc.crud.net/jsha/defer-crates/std/index.html