Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
inline and external scripts in the head affect parser

index.html:

<!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <style>
          p {
            color: red;
          }
        </style>
        <script src="script.js"></script>
        <!-- <script>
          console.log('script 1 starts');
          for (let i = 0; i < 3e9; i++) {}
          console.log('script 1 ends');
        </script> -->
      </head>
      <body>
        <p>paragraph</p>
        <script src="script2.js"></script>
        <style>
          p {
            color: blue;
          }
        </style>
      </body>
    </html>

script.js:

console.log('script 1 starts');
for (let i = 0; i < 3e9; i++) {}
console.log('script 1 ends');

script2.js:

console.log('script 2 starts');
for (let i = 0; i < 3e9; i++) {}
console.log('script 2 ends');

When I run this HTML file in the browser what I see is:

  1. Long loading of a browser
  2. Blue colored paragraph

If I comment out external script in the and comment in inline then I see:

  1. Loading of a browser
  2. Red coloured paragraph
  3. Loading of a browser
  4. Blue colored paragraph Question: Why I don't see red coloured paragraph in the first scenario? Should it matter for parser if the script in the is inline or external?
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!