]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #100956 - GuillaumeGomez:reduce-rightside-dom-size, r=notriddle
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 26 Aug 2022 12:08:47 +0000 (14:08 +0200)
committerGitHub <noreply@github.com>
Fri, 26 Aug 2022 12:08:47 +0000 (14:08 +0200)
Reduce right-side DOM size

This is another follow-up of https://github.com/rust-lang/rust/pull/100429 but not in code blocks this time.

So the idea is: if there is only one element in the `.rightside` element, there is no need to wrap it, we can just create one node.

On each page, I run this JS: `document.getElementsByTagName('*').length`. Important to note: the bigger the number of elements inside the page, the greater the gain. It also doesn't work very nicely on std docs because there are a lot of version annotations. So with this PR, It allows to get the following results:

| file name | before this PR | with this PR | diff |
|-|-|-|-|
| std/default/trait.Default.html | 2189 | 1331 | 39.2% |
| std/vec/struct.Vec.html | 14073 | 13842 | 1.7% |
| std/fmt/trait.Debug.html | 5313 | 4907 | 7.7% |
| std/ops/trait.Index.html | 642 | 630 | 1.9% |
| gtk4/WidgetExt | 3269 | 3061 | 6.4% |

You can test it [here](https://rustdoc.crud.net/imperio/reduce-rightsize-dom-size/gtk4/prelude/trait.WidgetExt.html).

r? `@notriddle`

1  2 
src/librustdoc/html/static/css/themes/ayu.css

index 63009006b3f1f906a2fb449ed130fc0a84535b07,f6614e89760303ac3bbce4a9712797f7bad095ac..8591f22d6de608987b54f1f21a035402da8d8649
@@@ -47,7 -47,7 +47,7 @@@ h4 
  .docblock pre > code, pre > code {
        color: #e6e1cf;
  }
 -span code {
 +.item-info code {
        color: #e6e1cf;
  }
  .docblock a > code {
@@@ -199,7 -199,7 +199,7 @@@ details.rustdoc-toggle > summary::befor
        background: none;
  }
  
- .rightside,
+ .rightside:not(a),
  .out-of-band {
        color: grey;
  }