rustdoc: optimize loading of source sidebar
The source sidebar has a setting to remember whether it should be open or closed. Previously, this setting was handled in source-script.js, which is loaded with `defer`, meaning it is often run after the document is rendered. Since CSS renders the source sidebar as closed by default, changing this after the initial render results in a relayout. Instead, handle the setting in storage.js, which is the first script to load and is the only script that blocks render. This avoids a relayout and means navigating between files with the sidebar open is faster.
This commit is contained in:
parent
bb8c2f4117
commit
b37a05bd01
5 changed files with 42 additions and 26 deletions
|
@ -32,7 +32,7 @@ assert-document-property: ({"URL": "/lib.rs.html"}, ENDS_WITH)
|
|||
|
||||
// First we "open" it.
|
||||
click: "#sidebar-toggle"
|
||||
assert: ".sidebar.expanded"
|
||||
assert: ".source-sidebar-expanded"
|
||||
|
||||
// We check that the first entry of the sidebar is collapsed (which, for whatever reason,
|
||||
// is number 2 and not 1...).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue