diff --git a/doc/api_assets/api.js b/doc/api_assets/api.js index 3e7cf017f602ee..8a768cf8511e47 100644 --- a/doc/api_assets/api.js +++ b/doc/api_assets/api.js @@ -118,7 +118,7 @@ function setupStickyHeaders() { ).observe(header); } -document.addEventListener('DOMContentLoaded', function() { +function bootstrap() { // Check if we have JavaScript support document.querySelector(':root').classList.add('has-js'); @@ -130,4 +130,10 @@ document.addEventListener('DOMContentLoaded', function() { // Track when the header is in sticky position setupStickyHeaders(); -}, { once: true }); +} + +if (document.readyState === 'complete') { + bootstrap(); +} else { + document.addEventListener('DOMContentLoaded', bootstrap, { once: true }); +} diff --git a/doc/template.html b/doc/template.html index 94e2937dcaf897..86ba3c9581e004 100644 --- a/doc/template.html +++ b/doc/template.html @@ -9,6 +9,7 @@ +
@@ -74,6 +75,5 @@

Node.js __VERSION__ documentation

-