styleguide icon indicating copy to clipboard operation
styleguide copied to clipboard

Seeing the Table of Contents section with delay.

Open ellietms opened this issue 3 years ago • 2 comments
trafficstars

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.

ellietms avatar Nov 29 '21 02:11 ellietms

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:)

Krish-bhardwaj avatar Jan 22 '22 05:01 Krish-bhardwaj

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.

Carrotman42 avatar Jan 03 '23 16:01 Carrotman42