diff options
| author | John Heitmann <jheitmann@gmail.com> | 2018-12-26 21:23:05 -0800 |
|---|---|---|
| committer | John Heitmann <jheitmann@gmail.com> | 2018-12-27 21:22:27 -0800 |
| commit | 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9 (patch) | |
| tree | 940845f1de40cbbc20fa23a23f4e8cef9243bf74 /src/librustdoc/html/static/main.js | |
| parent | f8caa321c7c7214a6c5415e4b3694e65b4ff73a7 (diff) | |
| download | rust-34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9.tar.gz rust-34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9.zip | |
Simplify foreign type rendering.
Simplified foreign type rendering by switching from tables to flexbox. Also, removed some seemingly extraneous elements like “ghost” spans. Reduces element count on std::iter::Iterator by 30%.
Diffstat (limited to 'src/librustdoc/html/static/main.js')
| -rw-r--r-- | src/librustdoc/html/static/main.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 02ffcf478f9..b376ab80412 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -2409,8 +2409,17 @@ if (!DOMTokenList.prototype.remove) { e.remove(); }); onEachLazy(main.childNodes, function(e) { + // Unhide the actual content once loading is complete. Headers get + // flex treatment for their horizontal layout, divs get block treatment + // for vertical layout (column-oriented flex layout for divs caused + // errors in mobile browsers). if (e.tagName === "H2" || e.tagName === "H3") { - e.nextElementSibling.style.display = "block"; + let nextTagName = e.nextElementSibling.tagName; + if (nextTagName == "H2" || nextTagName == "H3") { + e.nextElementSibling.style.display = "flex"; + } else { + e.nextElementSibling.style.display = "block"; + } } }); } |
