google / styleguide

Style guides for Google-originated open-source projects

Home Page:https://google.github.io/styleguide/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jsguide: Seeing the Table of Contents section with delay

ellietms opened this issue · comments

Hi, when we go to this page jsGuide, at first we see all the page contents at first and after a delay, we see the table of contents on the top of the page.

Hi i am a fresher looking for some opensource contribution can u help me out i want to contribute to your project and can u assign me this issue:)

The reason for this seems to be due to using the onload event: the jsguide.html has a <body onload="initStyleGuide();">, and function initStyleGuide (found in include/styleguide.js) contains a call to CreateTOC which dynamically builds the table of contents. Using onload causes the javascript to execute after the page has been fully loaded, as far as I can tell.

If someone wanted to find a way to avoid this, they'd have to somehow ensure the CreateTOC logic still works before the whole page is fully loaded; unfortunately, that code relies on (at least most of) the page being loaded to work, since it reads the DOM and creates the table of contents dynamically based on it.

yeah, unfortunate, but doesn't seem like we're going to do anything about it at this point