1
Fork 0

rustdoc: dedup search form HTML

This change constructs the search form HTML using JavaScript, instead of plain HTML. It uses a custom element because

- the [parser]'s insert algorithm runs the connected callback synchronously, so we won't get layout jank
- it requires very little HTML, so it's a real win in size

[parser]: https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token

This shrinks the standard library by about 60MiB, by my test.
This commit is contained in:
Michael Howell 2024-05-04 22:31:30 -07:00
parent 06e88c306a
commit eeb59f16a5
4 changed files with 48 additions and 26 deletions

View file

@ -4,7 +4,7 @@ javascript: false
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
show-text: true
assert-css: (".sub", {"display": "none"})
assert-false: ".sub"
// Even though JS is disabled, we should still have themes applied. Links are never black-colored
// if styles are applied so we check that they are not.