diff --git a/doc/api_assets/api.js b/doc/api_assets/api.js index 546722cd908ce7..3e7cf017f602ee 100644 --- a/doc/api_assets/api.js +++ b/doc/api_assets/api.js @@ -118,14 +118,16 @@ function setupStickyHeaders() { ).observe(header); } -// Check if we have JavaScript support -document.querySelector(':root').classList.add('has-js'); +document.addEventListener('DOMContentLoaded', function() { + // Check if we have JavaScript support + document.querySelector(':root').classList.add('has-js'); -// Restore user mode preferences -setupTheme(); + // Restore user mode preferences + setupTheme(); -// Handle pickers with click/taps rather than hovers -setupPickers(); + // Handle pickers with click/taps rather than hovers + setupPickers(); -// Track when the header is in sticky position -setupStickyHeaders(); + // Track when the header is in sticky position + setupStickyHeaders(); +}, { once: true }); diff --git a/doc/template.html b/doc/template.html index a65e51d9d46bae..94e2937dcaf897 100644 --- a/doc/template.html +++ b/doc/template.html @@ -74,6 +74,6 @@

Node.js __VERSION__ documentation

- +