hynky HF Staff commited on
Commit
d3c8adf
·
1 Parent(s): cd54439
Files changed (1) hide show
  1. dist/index.html +5 -3
dist/index.html CHANGED
@@ -7,9 +7,11 @@
7
  const htmlElement = document.documentElement;
8
  const newHtmlElement = htmlElement.cloneNode(true);
9
  htmlElement.parentNode.replaceChild(newHtmlElement, htmlElement);
10
- // Force a reflow
11
- void document.body.offsetWidth;
12
- console.log('DOCTYPE is present');
 
 
13
  }
14
  else {
15
  console.log('DOCTYPE is present');
 
7
  const htmlElement = document.documentElement;
8
  const newHtmlElement = htmlElement.cloneNode(true);
9
  htmlElement.parentNode.replaceChild(newHtmlElement, htmlElement);
10
+ // Wait for DOM to be ready before forcing reflow
11
+ document.addEventListener('DOMContentLoaded', () => {
12
+ void document.body.offsetWidth;
13
+ console.log('DOCTYPE is present');
14
+ });
15
  }
16
  else {
17
  console.log('DOCTYPE is present');