Improve loading of crates.js and sidebar-items.js#98124
Merged
bors merged 1 commit intorust-lang:masterfrom Jun 21, 2022
Merged
Improve loading of crates.js and sidebar-items.js#98124bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Contributor
|
Some changes occurred in HTML/CSS/JS. |
This comment has been minimized.
This comment has been minimized.
GuillaumeGomez
approved these changes
Jun 15, 2022
Member
|
Looks great, thanks! r=me with CI fixed. |
Member
|
Oh actually, on source code pages, you don't need to load |
This comment has been minimized.
This comment has been minimized.
Member
|
I think you need to update the |
Member
|
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
Contributor
Author
|
@bors r=GuillaumeGomez rollup |
Collaborator
|
📌 Commit 27dcebe has been approved by |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jun 21, 2022
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
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this pull request
Jun 21, 2022
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
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jun 21, 2022
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
Folyd
added a commit
to huhu/rust-search-extension
that referenced
this pull request
Jul 4, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
deferattribute 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
Pagetemplate. 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