]> git.sur5r.net Git - i3/i3.github.io/commitdiff
Bugfix: Use DOM loaded event for TOC
authorTony Crisci <tony@dubstepdish.com>
Tue, 1 Apr 2014 05:46:28 +0000 (01:46 -0400)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 9 Apr 2014 18:23:08 +0000 (20:23 +0200)
The document "DOMContentLoaded" event will fire as soon as the DOM is
ready to be manipulated by the TOC building script.

The window.onload function should not be used for this because it waits
until the window is rendered in the browser to run the script, causing a
flash of partially rendered content.

_docs/conf/i3html.conf

index 362d8e975b1bf780bb4f566319b52e629922b726..7202ef22035d492970d077998f56c0466041706a 100644 (file)
@@ -560,7 +560,7 @@ ifdef::linkcss[]
 <script type="text/javascript">
 # Escape as CDATA to pass validators.
 /*<![CDATA[*/
-window.onload = function()\{asciidoc.footnotes();{toc? asciidoc.toc({toclevels});}\}
+document.addEventListener("DOMContentLoaded", function()\{asciidoc.footnotes();{toc? asciidoc.toc({toclevels});}\}, false);
 /*]]>*/
 </script>
 <script type="text/javascript" src="{scriptsdir=.}/asciidoc-xhtml11.js"></script>
@@ -569,7 +569,7 @@ ifndef::linkcss[]
 <script type="text/javascript">
 # Escape as CDATA to pass validators.
 /*<![CDATA[*/
-window.onload = function()\{asciidoc.footnotes();{toc? asciidoc.toc({toclevels});}\}
+document.addEventListener("DOMContentLoaded", function()\{asciidoc.footnotes();{toc? asciidoc.toc({toclevels});}\}, false);
 include1::{scriptsdir=./javascripts}/asciidoc-xhtml11.js[]
 /*]]>*/
 </script>