From 4a6fb45ee1c51a67d75d99244446868b36f22cc6 Mon Sep 17 00:00:00 2001 From: Kang Seonghoon Date: Thu, 5 Mar 2015 23:10:15 +0900 Subject: [PATCH] rustdoc: Reworded comments to give the rationale for JS. --- src/librustdoc/html/render.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index a9a9d0f7694..0edeff71364 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2209,7 +2209,14 @@ impl<'a> fmt::Display for Sidebar<'a> { let it = self.item; let parentlen = cx.current.len() - if it.is_mod() {1} else {0}; - // this is not rendered via JS, as that would hamper the accessibility + // the sidebar is designed to display sibling functions, modules and + // other miscellaneous informations. since there are lots of sibling + // items (and that causes quadratic growth in large modules), + // we refactor common parts into a shared JavaScript file per module. + // still, we don't move everything into JS because we want to preserve + // as much HTML as possible in order to allow non-JS-enabled browsers + // to navigate the documentation (though slightly inefficiently). + try!(write!(fmt, "

")); for (i, name) in cx.current.iter().take(parentlen).enumerate() { if i > 0 {